[rhos-list] openstack-db command error

Pádraig Brady pbrady at redhat.com
Sun Feb 10 03:28:44 UTC 2013


On 02/07/2013 07:46 PM, Pádraig Brady wrote:
> On 02/07/2013 07:25 PM, Shixiong Shang (shshang) wrote:
>> Hi, experts:
>>
>> I am running "openstack-db" command to initiate database table for nova and saw this error:
>>
>> [dmd at as-msg1 ~]$  sudo openstack-db --init --service nova --password nova --rootpw mysql
>> Verified connectivity to MySQL.
>> Creating 'nova' database.
>> ERROR 1396 (HY000) at line 2: Operation CREATE USER failed for 'nova'@'localhost'
>>
>> It traced back to the following two commands in the "openstack-db" script under /usr/bin:
>> CREATE USER '$APP'@'localhost' IDENTIFIED BY '${MYSQL_APP_PW}';
>> CREATE USER '$APP'@'%' IDENTIFIED BY '${MYSQL_APP_PW}';
>>
>>
>> I tried to manually create DB and user in mysql and it still gave me the same error.
>> CREATE USER 'nova@'localhost' IDENTIFIED BY 'nova';
>> CREATE USER 'nova'@'%' IDENTIFIED BY 'nova';
>>
>> If I used the following command instead, it passed successfully.
>> CREATE USER 'nova' IDENTIFIED BY 'nova';
>>
>> Is it normal? Thanks!
>
> What version of mysql are you using?
>
> I'll not also that we have a new packstack installer
> for setting up these things rather than the lower
> level openstack-db commands.

So looking further into this, the obtuse "ERROR 1396 (HY000)",
essentially means the user already exists in the mysql DB.
So I'm guessing that because the nova-manage command initially
failed because of the previously discussed settings issues,
you may have tried to manually clean the database and users,
which is a little tricky to do robustly in mysql.

With the correct config in place you would not have run into
this issue, but we can do better in this case.  For the next
version of openstack-db we'll indicate clearly that the
user still exists in the database and suggest to use the
--drop mode to clear the database before trying again.

As a quick way to supply the correct config for the nova-manage
version you have currently installed, you could do the following.
A caveat to note is to `rm /etc/nova-manage.conf` when upgrading
to the next version of openstack-nova-common, so that config
precedence rules are honored correctly.

   ln -nsf /usr/share/nova/nova-dist.conf /etc/nova-manage.conf

So with the correct config in place you should be able to
clear everything with the following command, before following
the documented instructions:

   sudo openstack-db --drop --service nova --password nova --rootpw mysql

Note the operations need to be done for cinder, so just
replace cinder with nova above.

thanks,
Pádraig.

p.s. I'll note again that testing is currently concentrating on
the packstack installer and we'll over time stop supporting
these lower level scripts.




More information about the rhos-list mailing list