mysql 忘记密码 - Willcys/Python GitHub Wiki

mysql5.7.6 和以后的版本 vim /etc/mysql.cnf 添加 skip-grant-tables 重启mysql 进去mysql 没有密码 select user,host,authentication_string from mysql.user; update mysql.user set authentication_string=password('密码') where user='root';/mys

\q 推出mysql 注释或者删除 /etc/mysql.cnf 中的添加行

重启mysql

5.7.5以前的mysql update mysql.user set password=password("密码")where user="root" and host="localhost"; flush privileges;

alter user user(root) identified by '密码'