How to modify the mysql password and forget the mysql password bitsCN.com
How to modify the mysql password and forget the mysql password
Modify the MySQL password:
1 mysqladmin-u root-p password 1234562 mysqladmin-u username-p old password new password
Forget the MySQL password:
01 chown-R mysql: mysql/var/lib/mysql02/etc/init. d/mysql stop or kill-9 kill the process. 03 [root @ corshetlpro01 bin] # cd/usr/local/mysql/bin04./mysqld_safe -- user = mysql -- skip-grant-tables -- skip networking & 05 [root @ corshetlpro01 bin] # ps-ef | grep mysql06root 26544 25356 0 00:00:00 pts/18/bin/sh. /mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking07mysql 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 -- port = 330608 root 27223 25356 0 00:00:00 pts/18 grep mysql09./mysql-u root10mysql> use mysql; 11 mysql> update user set password = password ('newpassword ') where user = 'root'; 12 mysql> flush privileges; 13 mysql> quit14 #/etc/init. d/mysql restart15 # mysql-uroot-p16enter password:
<输入新设的密码newpassword>
BitsCN.com