Where or how do I check MySQL root password? I don't have a .my.cnf
file, I can't login to SQL console (it requires a password), I can't do anything.
5 Answers
There is no way to lookup the password. It is encrypted. On many systems the root password is blank by default. On other systems you would have been asked to set the root password when you installed mysql. The password reset procedure is described here (http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html).
-
arggg... so troublesome!!! Is there any easier way?– mysqllearnerNov 20, 2009 at 8:28
-
-
I think it installed by my web hosting company. What should i do? I must reset the password?? No others options?? (sigh)– mysqllearnerNov 20, 2009 at 8:34
-
Yeah, remember what the password was if you setup the system. Or go find the person who set it up for you and ask them. If you can't manage that you could, provide more details about what type of environment (OS/Version/etc) you are running on, and somebody might provide you with step-by-step details. Nov 20, 2009 at 8:35
-
You could call your the support number for your web hosting company. They almost certainly have the procedure down pat. Nov 20, 2009 at 8:35
If you manage to get a shell you can set it this way:
Start mysql with:
mysqld_safe --skip-grant-tables
Log in mysql
mysql --user=root mysql
Update the root password:
UPDATE user SET Password=PASSWORD('newpwd') WHERE User='root';
flush privileges;
exit;
I think that you may look at your /root/.mysql_history or on your applications web, ... using mysql maybe you will find some useful information there.
If you are on a Debian or Ubuntu you could set a new root password like this:
sudo dpkg-reconfigure mysql-server
You can start the MySQL daemon with --skip-grant-tables
, access it and change the root password then restart it,
mysqld_safe --skip-grant-tables &
-
1