mysql root password issues

Hi, I reinstalled my server and it got rid of all of the mail issues I was having in my other post, but now I am having issues with mysql. I set the password when I installed mysql, but now the password is blank, and I can’t change it, I have tried through webmin, phpmyadmin, and through booting mysql into safe mode and editing the mysql table itself, no matter what I do, I can’t change the password. everything was fine till I installed squirrelmail and phpmyadmin and then created my first virtual host. now neither of my mysql admin accounts have passwords, they are blank. and they are limited to the information_schema database. anyone know how I can fix this, I have tried uninstalling mysql-server mysql-client and all of teh dependancies (it also took dovecot and proftpd with it) and then reinstalled them, then reinstalled dovecot and proftpd. but still to no avail, no password on the admin accounts, and I am unable to create one. any help would be apprecieated. TIA I am running ubuntu server 8.04

Hmm, I’m not sure I follow what exactly is going on or how it might have happened, but two things that may help:

  1. You should be able to change the MySQL root password from within Webmin -> Servers -> MySQL Database Server, and go into "Configurable Options".

  2. When you log into Virtualmin, and then select a domain from the dropdown, there’s an option “Edit Databases”. You can see what databases a given Virtual Server has rights to, as well as set the database user’s password.

I can’t create databases because I lost root access once the password went blank. root password is blank, so webmin/virtualmin wont let me do anything with the mysql server and I am limited to just the information_schema database. I can’t create new ones, or access any of the other databases. I have tried every way I can find to reset the mysql root password, but every attempt fails. I have tried dpkg-reconfigure mysql-server, I have tried through webmin/virtulmin, I have tried booting the mysql server into safe mode and skipping the grant tables, all to no avail. anyone have any ideas

When you say the root password is "blank", what do you mean by that exactly? Where are you seeing it as blank?

Being blank is a valid password, and would mean that from the command line, you could type something like:

mysql -u root

And it would log you in without prompting you for a password.

But I can’t help but think something else seems out of whack :slight_smile:

I’m not sure if you tried this yet or not, but one of the ways to reset the MySQL root password is with the steps outlined here:

I just tried the steps aboave and it didn’t work. when I try to create a new database or connect it says: DBI connect failed : Access denied for user ‘’@‘localhost’ to database ‘mysql’ when there is no root password, I am limed to the information_schema database, I can’t create new databases or anything, so I can’t use virtualmin to create databases either. any other ideas as to how I can correct this.

It almost sounds like it doesn’t know what user it’s trying to connect with.

If you log into Virtualmin, and go to Webmin -> Servers -> MySQL Database Server, look in Module Config.

At the top, there’s an option named “Administration login”.

Rather than having it set to automatic, check the option for the left-most checkbox, and add "root" in there as the user to use.

I was able to get it working, I had to reinstall but was able to get it working.

I had issues and could finaly get to change the root password with this :

kill `cat /var/run/mysqld/`

mysqld --skip-grant-tables


UPDATE mysql.user SET Password=PASSWORD('my-new-password') WHERE User='root';

(of course change “my-new-password” with your own password) stop and restart mysql normaly

/etc/init.d/mysql restart

and that should work now