mysql-忘记密码

登陆:mysql -uroot -p

 

配置:path:PATH=“$PATH”:/usr/local/mysql/bin

 

重置密码:

 

// 进入数据库指令文件

cd /usr/local/mysql/bin

// 跳过权限认证

sudo ./mysqld_safe --skip-grant-tables

 

另起终端:

//  执行mysql指令

/usr/local/mysql/bin/mysql

// 进入名为<mysql>的数据库

use mysql

// 刷新权限

flush privileges;

// 修改密码

set password for 'root'@'localhost' = password(’新密码’);

// 退出mysql

exit

 

1. 启动mysql服务

sudo /usr/local/mysql/support-files/mysql.server start

2. 停止mysql服务

sudo /usr/local/mysql/support-files/mysql.server stop

3. 重启mysql服务

sudo /usr/local/mysql/support-files/mysql.server restart

posted @ 2019-07-30 10:41  浅夏、  阅读(103)  评论(0编辑  收藏  举报