Skip to content

Commit b78b490

Browse files
author
Wuxi
committed
doc: 添加修改mysql文档
1 parent 8aa62d2 commit b78b490

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

tips/MysqlForgetPassword.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Mysql忘记root账号密码
2+
3+
1. 关闭mysql服务
4+
5+
`sudo /usr/local/bin/mysql.server stop`
6+
7+
如果是在mac上,可以直接在设置中点击关闭
8+
9+
2. 进入目录,获取权限,启动安全模式
10+
11+
`cd /usr/local/mysql/bin`
12+
13+
`sudo su`
14+
15+
`./mysqld_safe --skip-grant-tables &`
16+
17+
3. 再打开一个终端,进入mysql
18+
19+
`mysql`
20+
21+
`use mysql`
22+
23+
`flush privileges;`
24+
25+
`ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY '123456';`
26+
27+
`flush privileges;`
28+
29+
`exit;`
30+
31+
有的客户端可能不支持`caching_sha2_password`加密方式,看情况可以改成`mysql_native_password`
32+
33+
4. 最后杀进程
34+
35+
`ps -ef | grep mysql`查看相关的进程,杀死并重启mysql

tips/tips_index.MD

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
5. [数据库备份](https://supergithuber.github.io/tips/backupDatabase)
1010
6. [梅林固件无法访问软件中心](https://supergithuber.github.io/tips/meilinSoftwareCenter)
1111
7. [pyenv无法修改Python --version显示的版本](https://supergithuber.github.io/tips/pyenvShowPythonVersion)
12+
8. [Mysql忘记账号密码](https://supergithuber.github.io/tips/MysqlForgetPassword)

0 commit comments

Comments
 (0)