mysql 5.7.12 修改密码

vim /etc/my.cnf

skip-grant-tables

/etc/init.d/mysqld restart

mysql 直接登陆

use mysql

update mysql.user set authentication_string=password('123456') where user='root';


修改完成以后注意把 skip-grant-tables 这行去掉不然一直不需要密码