1. Stop MySQL Service Execution: etcinit. dmysqlstop on your machine may not be etcinit. dmysql, or etcinit. dmysqld2. skip verification to start MySQLusrlocalmysqlbinmysqld_safe -- skip
1. Stop MySQL Service Execution:/etc/init. d/mysql stop is not necessarily/etc/init on your machine. d/mysql, or/etc/init. d/mysqld 2. skip verification to start MySQL/usr/local/mysql/bin/mysqld_safe -- skip-grant-tables/dev/null 2 1 Note: If mysqld_s
1. Stop the MySQL Service
Run:
/Etc/init. d/mysql stop
Not necessarily/etc/init. d/mysql on your machine, or/etc/init. d/mysqld
2. Skip verification to start MySQL
/Usr/local/mysql/bin/mysqld_safe -- skip-grant-tables>/dev/null 2> & 1 &
Note: If the location of mysqld_safe is different from above, you need to change it to yours. If you are not clear about it, you can use the find command to find it.
3. Reset the password
Wait for a while and then execute:
/Usr/local/mysql/bin/mysql-u root mysql
Enter:
Update user set password = Password ('password to set') where User = 'root ';
Press enter and execute:
Flush privileges;
Refresh the table related to MySQL system permissions. Run the following command:
Exit;
Exit.
4. Restart MySQL
Kill the MySQL process:
Killall mysqld
Restart MySQL:
/Etc/init. d/mysql start
Original article address: reset the MySQL root Password in Linux. Thank you for sharing it with me.