How to modify the mysql password and forget the mysql password. If you need it, refer
How to modify the mysql password and forget the mysql password. If you need it, refer
Modify the MySQL password:
The Code is as follows:
Mysqladmin-u root-p password 123456
Mysqladmin-u username-p old password New password
Forget the MySQL password:
The Code is as follows:
Chown-R mysql: mysql/var/lib/mysql
/Etc/init. d/mysql stop or kill-9 to kill the process.
[Root @ corshetlpro01 bin] # cd/usr/local/mysql/bin
./Mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &
[Root @ corshetlpro01 bin] # ps-ef | grep mysql
Root 26544 25356 0 00:00:00 pts/18/bin/sh./mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking
Mysql 26673 26544 0 00:00:00 pts/18/usr/local/mysql/libexec/mysqld -- basedir =/usr/local/mysql -- datadir =/var/lib/mysql -- user = mysql -- skip-grant-tables -- skip-networking -- log-error =/var/lib/mysql/corshetlpro01.err -- pid-file =/var/lib/mysql/corshetlpro01.pid -- socket = /tmp/mysql. sock -- Ports = 3306
Root 27223 25356 0 00:00:00 pts/18 grep mysql
./Mysql-u root
Mysql> use mysql;
Mysql> update user set password = password ('newpassword') where user = 'root ';
Mysql> flush privileges;
Mysql> quit
#/Etc/init. d/mysql restart
# Mysql-uroot-p
Enter password: <输入新设的密码newpassword>