The most important user of the server MySQL It is definitely the user "root". The user that has all administrative privileges databases (MySQL databases).
If you do not know what the password is set to the root user of MySQL, you should follow some simple steps to reset the password. We did this on a MySQL installed on 5.6 CentOS.
Reset / Recover MySQL root passowrd
1. We login with the username root system that is the MySQL server. (User's root system, not MySQL). Log directly from the console or remotely via connection ssh (with putty on Windows).
2. The stop / MySQL.
service mysqld stop
/ Etc / init.d / mysqld stop
The result will be:
Stopping MySQL: [OK]
3. We start the MySQL server with the "-skip-grant-tables". Starting MySQL server / daemon process without password.
mysqld_safe -skip-grant-tables &
The result after the above command line:
[Root @ server ~] # Starting mysqld daemon with databases from / var / lib / mysql
4. We connect to the MySQL server with the root user, using the command:
The output of:
Welcome to the MySQL monitor. Commands end with; or g.
Your MySQL connection id is 1
Server version: 5.0.77 Source distribution
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
5. Select base mysql and set the new password for the root user.
update user set password = PASSWORD ( "NEW-PASSWORD") WHERE User = 'root';
Resulting from the above commands:
mysql> use mysql;
Reading table information for completion of table and column names
You-can turn off this feature to get a Quicker startup with -A
mysql> update user set password = PASSWORD ( '123456') WHERE User ='root';
Query OK, 0 rows AFFECTED (0.00 sec)
Rows matched: 3 Changed: Warnings 0: 0
mysql> flush privileges;
Query OK, 0 rows AFFECTED (0.01 sec)
[Root @ server ~] #
6. Stop and restart service / MySQL
service mysqld stop
service mysqld start
Starting MySQL: [OK]
In the picture below, it is shown all the password reset user's root MySQL.
Now we can connect to MySQL (by phpMyAdmin eg.) with the root user using the new password set above.
Tutorial tested CentOS 5.6 See 14.12 MySQL Distrib 5.0.77, for redhat-linux-gnu (i686) using readline 5.1.