《Mysql實例Mysql5.7修改root密碼教程》要點:
本文介紹了Mysql實例Mysql5.7修改root密碼教程,希望對您有用。如果有疑問,可以聯系我們。
版本更新,原來user里的password字段已經變更為authentication_stringMYSQL必讀
版本更新 緣故,好多網上的教程都不適用了,甚至連官網的文檔也不是能夠順利操作的.MYSQL必讀
如果 MySQL 正在運行,首先殺之:MYSQL必讀
killall -TERM mysqld.
運行MYSQL必讀
mysqld_safe --skip-grant-tables &
如果此時不想被遠程連接:mysqld_safe --skip-grant-tables --skip-networking &MYSQL必讀
使用mysql連接serverMYSQL必讀
更改密碼:MYSQL必讀
update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';
*特別提醒注意的一點是,新版的mysql數據庫下的user表中已經沒有Password字段了MYSQL必讀
而是將加密后的用戶密碼存儲于authentication_string字段MYSQL必讀
mysql> flush privileges; mysql> quit;
修改完畢.重啟MYSQL必讀
killall -TERM mysqld. mysqld_safe &
然后mysql就可以連接了MYSQL必讀
但是此時操作似乎功能不完全,還要alter user...MYSQL必讀
alter user 'root'@'localhost' identified by '123';
網文說醬紫也可以:MYSQL必讀
set password for 'root'@'localhost'=password('123'); cp mysql.server /etc/init.d/mysql chmod +x /etc/init.d/mysql chkconfig --add mysql
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/5234.html