1. You forget the root user password of your system. I forgot the root user solution in Linux to solve this problem first.) log on to the system and enter the terminal.
[Root @ localhost/] #
Ii. Killing the MySQL process
Method 1: [root @ localhost/] # killall mysqld
Method 2: [root @ localhost/] # ps-Aux // view all processes and find the MySQL process PID
Then
[Root @ localhost/] # kill PID // PID indicates the MySQL process ID
3. Use the -- skip-grant-tables parameter to start mysqld
[Root @ localhost/] #/usr/local/MySQL/bin/mysqld_safe -- skip-grant-tables &
// Where/usr.../bin is my MySQL installation directory
[Root @ localhost/] #/usr/local/MySQL/bin/MySQL // enter MySQL
Mysql> use MySQL // switch to MySQL database
Mysql> Update user SET Password = PASSWORD ('000000') where user = 'root ';
// Set the root password to 123456.
Iv. Notes
The full command to load MySQL like this is:
Mysqld_safe -- skip-grant-tables -- autoclose
(Editor's note: Our Technical Reviewer found that he had to launch the mysqld_safe command
Without the '-- autoclose' flag, otherwise the daemon never started .)
This is what foreign websites have said. I have succeeded in using autoclosa.
However, the following error message is displayed when I run/usr/local/MySQL/bin/mysqld_safe -- skip-grant-tables:
./Mysqld_safe
Starting mysqld daemon with databases from/usr/local/var
Stopping server from PID file/usr/local/var/localhost. localdomain. PID
Mysqld ended
Then enter/usr/local/var/
Vi./localhost. localdomain. Err contains the following content:
050410 04:02:59 mysqld started
050410 4:03:00 InnoDB: operating system error number 13 in a file operation.
InnoDB: the error means mysqld does not have the access rights
InnoDB: the directory.
InnoDB: file name./ibdata1
InnoDB: File Operation call: 'create '.
InnoDB: cannot continue operation.
050410 04:03:00 mysqld ended
If the access permission of the./var directory is suspected, perform the following operations:
Chmod 777./var
Then re-execute the background, and the above error still exists, but the error message in the localhost. localdomain. Err file is changed to not found
Help. * file (I cannot remember this file name)
This is because the read and write permissions of my MySQL installation directory are as follows:
The MySQL installation directory belongs to the user root, but the group is MySQL
Change the group to root.