Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 7 down vote accepted

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 (

share|improve this answer
arggg... so troublesome!!! Is there any easier way? – mysqllearner Nov 20 '09 at 8:28
Um - How did you install it? – meder omuraliev Nov 20 '09 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 '09 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 '09 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 '09 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;
share|improve this answer

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

share|improve this answer

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 &
share|improve this answer
What's with making things that big? – Kevin M Nov 20 '09 at 13:05

By default, it's the following pair:

  • username: "root"
  • password: ""
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.