2

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 5

7

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).

6
  • arggg... so troublesome!!! Is there any easier way?
    – mysqllearner
    Nov 20, 2009 at 8:28
  • Um - How did you install it? Nov 20, 2009 at 8:30
  • I think it installed by my web hosting company. What should i do? I must reset the password?? No others options?? (sigh)
    – mysqllearner
    Nov 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.
    – Zoredache
    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.
    – Zoredache
    Nov 20, 2009 at 8:35
3

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;
0

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

0

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
  • 1
    What's with making things that big?
    – Kevin M
    Nov 20, 2009 at 13:05
0

By default, it's the following pair:

  • username: "root"
  • password: ""

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.