重置忘记的mysql root密码

3/3/2017来源:C/C++教程人气:1242

步骤

停止MySQL服务

进入mysql安全模式 mysqld_safe –skip-grant-tables

mysql -u root -p

use mysql;

describe user;

update user set authentication_string= passWord(‘123456’) where user=’root’;

flush PRivileges;

重启mysql

题外话:mac为当前用户配置mysql环境变量 vim ~/.bash_profile export PATH=$PATH:/usr/local/mysql-5.7.17-macos10.12-x86_64/bin source .bash_profile