File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change 9
9
5 . [ 数据库备份] ( https://supergithuber.github.io/tips/backupDatabase )
10
10
6 . [ 梅林固件无法访问软件中心] ( https://supergithuber.github.io/tips/meilinSoftwareCenter )
11
11
7 . [ pyenv无法修改Python --version显示的版本] ( https://supergithuber.github.io/tips/pyenvShowPythonVersion )
12
+ 8 . [ Mysql忘记账号密码] ( https://supergithuber.github.io/tips/MysqlForgetPassword )
You can’t perform that action at this time.
0 commit comments