Bacula-users

Re: [Bacula-users] upgrading bacula problem with mysql - Solved

2011-03-02 18:21:28
Subject: Re: [Bacula-users] upgrading bacula problem with mysql - Solved
From: Phil Stracchino <alaric AT metrocast DOT net>
To: bacula-users AT lists.sourceforge DOT net
Date: Wed, 02 Mar 2011 18:18:47 -0500
On 03/02/11 17:52, Maria Mckinley wrote:
> On 3/2/11 2:06 PM, Maria Mckinley wrote:
>> Message: 20
>> From: Phil Stracchino <alaric AT metrocast DOT net>
>>  > Connect to your Bacula DB as your administrative user (probably root)
>>  > and change the password for Bacula, as follows:
>>
>>  > UPDATE mysql.user SET password=PASSWORD('your new password here')
>>  > WHERE user='bacula';
>>  > FLUSH PRIVILEGES;

>> Now I am very confused. Once I changed the password for user bacula, I
>> can no longer log in at the command line as bacula, and of course,
>> bacula cannot log in.

>> Type 'help;' or '\h' for help. Type '\c' to clear the current input
>> statement.
>> mysql> UPDATE mysql.user SET password='xxx' WHERE user='bacula';
>> Query OK, 2 rows affected (0.00 sec)
>> Rows matched: 2 Changed: 2 Warnings: 0
>>
>> mysql> FLUSH PRIVILEGES;
>> Query OK, 0 rows affected (0.00 sec)
>>
>> mysql> exit
>> Bye
>> billie:~# mysql -u bacula -p
>> Enter password:
>> ERROR 1045 (28000): Access denied for user 'bacula'@'localhost' (using
>> password: YES)

> Not sure exactly what happened, but the password in MySQL was definitely 
> the problem. I logged into MySQL as root, and looked at the password 
> table, and noticed that the password for the user bacula was not 
> encrypted, but all of the other user passwords were.

Yes, that's because you set the password field to the literal password,
instead of calling password() to generate a password hash.

> I looked up the 
> command in the MySQL manual, and it appears you need parentheses around 
> the password:

More to the point, you need to call the password() function with your
new password as the argument.

> mysql> UPDATE mysql.user SET Password = PASSWORD('xxxx')
>      -> WHERE User = 'bacula';
> Query OK, 1 row affected (0.02 sec)
> Rows matched: 1  Changed: 1  Warnings: 0

...Yup, just like that.


> When I looked at the password table after flushing this, the password 
> for bacula was encrypted, and I was again able to login as bacula. And, 
> I was able to start bconsole and my backup seems to be back up and 
> running! Yay!

So it looks as though the original problem was indeed that the upgrade
left you with mismatched passwords.  Glad to hear that everything's
working now that they're consistently set again.


For future reference, always remember that no MySQL password changes or
grants take effect until you either execute 'flush privileges' or
restart MySQL.  So any time you're changing the MySQL password for root,
use two sessions; change the password in one, flush privileges, *then*
try to log in a second session *with the new password*, so that you can
verify it's working *while you still have a logged-in session*, just in
case you get it wrong and need to reset it.

(Losing your MySQL admin password is fixable.  It can be reset without
loss of any data, but you need to know what you're doing.  Best to avoid
the situation in the first place.)


-- 
  Phil Stracchino, CDK#2     DoD#299792458     ICBM: 43.5607, -71.355
  alaric AT caerllewys DOT net   alaric AT metrocast DOT net   phil AT 
co.ordinate DOT org
  Renaissance Man, Unix ronin, Perl hacker, SQL wrangler, Free Stater
                 It's not the years, it's the mileage.

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users