MySQL Restores Failing

22 posts / 0 new
Last post
#1 Wed, 04/22/2009 - 11:06
wyatt

MySQL Restores Failing

I'm struggling with a problem with backup and restores on one of our systems.. I can't seem to track down what's going on here and hoping someone can help without needing to open a support case.

When I do a backup of a virtual server (only Apache and MySQL configured for the virtual server) and do a restore, it always fails to connect to the MySQL database when trying to recreate it. I "untarred" the backup and checked the .backup/<username>_webmin file and it looks like the username/password is correct, but the output when trying to restore says that access denied when connecting to username @ localhost. I can use mysql to connect to the database from the shell just fine.

I even tried to create a whole new virtual server to test with. I did a default Drupal install, backup and restore. When it restored, it did the same thing. All the files were there in the home directory, I was just missing my MySQL data (database and user do exist).

The admin password and MySQL password are the same, and when I created the new server I left it that way as well.

I can then use the "execute SQL" option in Virtualmin to restore the database after I extract it from the tarball, but that's less than ideal.

Server is: Virtualmin 3.67 Pro and Ubuntu 8.04, fully patched.

Thanks for any help!

Wed, 04/22/2009 - 11:13
andreychek

Howdy,

So, just to verify, if you type this from the command line:

[code:1]grep pass= /etc/webmin/mysql/config[/code:1]

Is that the root MySQL password that you'd expect? Does that password work if you type &quot;mysql -u root -p&quot; and enter the password when prompted?
-Eric

Wed, 04/22/2009 - 11:17 (Reply to #2)
wyatt

Thanks for the quick response.

The password in that file is indeed correct. I am able to connect as root to MySQL with it.

From the output it looks like it's trying to connect to MySQL as the user, however. Is that not the case?

Wed, 04/22/2009 - 15:37 (Reply to #3)
andreychek

You may be right, and you did mention that above, I was just making extra sure! :-)

I honestly have no idea what might cause what you're seeing -- I'm going to ask Jamie if he can take a peek at your issue.
-Eric

Wed, 04/22/2009 - 16:21 (Reply to #4)
Joe
Joe's picture

One thing to check is if you have a /root/.my.cnf or /.my.cnf file on your system. In some cases, if this contains a password= line which is incorrect it can override the password Webmin tries to use to connect to MySQL.

If this file exists, either delete it or remove or correct the password= line.

--

Check out the forum guidelines!

Wed, 04/22/2009 - 18:10 (Reply to #5)
wyatt

Should I look for that .my.cnf file in the home directory of the user I'm trying to run the restore as or in root's home directory?

Wed, 04/22/2009 - 18:18 (Reply to #6)
wyatt

I guess I'll answer my question quick.. I didn't find a .my.cnf file in /root, /, or the user's home directory.

Thanks for your help

Wed, 04/22/2009 - 18:32 (Reply to #7)
andreychek

Just for fun, if you ran a &quot;find&quot; on the entire system, does that show anything? You can do that with:

find / -name .my.cnf

Thanks!
-Eric

Wed, 04/22/2009 - 18:41 (Reply to #8)
wyatt

Didn't find anything :(

Wed, 04/22/2009 - 19:01 (Reply to #9)
Joe
Joe's picture

Another thing you can try is going to Webmin -&gt; Servers -&gt; MySQL Database -&gt; Module Config, and change the 'Use MYSQL_PWD variable to pass password?' option to 'No'.

--

Check out the forum guidelines!

Thu, 04/23/2009 - 09:07 (Reply to #10)
wyatt

Didn't do the trick either :(

Is there a way I can turn on some debug logging?

Thu, 04/23/2009 - 09:34 (Reply to #11)
Joe
Joe's picture

One more thing to try - go to Webmin -&gt; Servers -&gt; MySQL Database, and make sure that it shows the existing databases on your system correctly.

--

Check out the forum guidelines!

Mon, 04/27/2009 - 11:14 (Reply to #12)
wyatt

Sorry, didn't have time to respond over the weekend.

Are you asking if we can manage the MySQL database from Webmin? If so, yes I can.

Thanks!

Mon, 04/27/2009 - 11:21 (Reply to #13)
Joe
Joe's picture

Ok .. can you use the MySQL module to create and restore backups of databases?

--

Check out the forum guidelines!

Mon, 04/27/2009 - 11:24 (Reply to #14)
wyatt

Yeah, I can create backups of the MySQL databases and restore them manually, but the restore doesn't seem to work when it's bundled up in a Virtualmin backup.

Mon, 04/27/2009 - 11:36 (Reply to #15)
Joe
Joe's picture

Are you doing this restore while logged into Virtualmin as root, or as a domain owner?

--

Check out the forum guidelines!

Mon, 04/27/2009 - 11:52 (Reply to #16)
wyatt

Hmm well I feel like a bit of a n00b that I didn't mention that, but yes, I've been trying to do this as the domain owner.

It does appear that root (or my user that has sudo access) is able to do a restore. I hadn't tried that before.. (the idea behind utilizing Virtualmin on this server is so users can test upgrades and fail back to a user-created backup without involving one of our admins).

I'll try to answer the next logical question: when I login as the user trying to do the restore, I am able to manage that user's databases.

Mon, 04/27/2009 - 12:14 (Reply to #17)
Joe
Joe's picture

Ok, I see the bug that is causing this now, and will fix it in the next Virtualmin release. If you don't want to wait till then, you can edit the file virtual-server/feature-mysql.pl under the Webmin root directory, and change line 491 from :

[code:1]&amp;mysql_user($_[0]), &amp;mysql_pass($_[1], 1));[/code:1]

to :

[code:1]&amp;mysql_user($_[0]), &amp;mysql_pass($_[0], 1));[/code:1]

--

Check out the forum guidelines!

Mon, 04/27/2009 - 12:27 (Reply to #18)
wyatt

Sweet! Thank you so much!

I'll make the change and confirm with the user.

Mon, 04/27/2009 - 12:38 (Reply to #19)
Joe
Joe's picture

Also, you'll need to restart Webmin after making this change, with the command /etc/webmin/restart

--

Check out the forum guidelines!

Tue, 04/28/2009 - 05:03 (Reply to #20)
wyatt

I got confirmation from the user that they were able to restore.

Thanks so much!

Is there a way to mark this thread solved?

Tue, 04/28/2009 - 07:54 (Reply to #21)
Joe
Joe's picture

I think your report of success marks it as resolved :-)

--

Check out the forum guidelines!