You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
342 B
21 lines
342 B
2 weeks ago
|
1. 停止当前mysqld服务
|
||
|
`service mysql stop`
|
||
|
|
||
|
2. 用安全模式启动
|
||
|
`sudo mysqld_safe --skip-grant-tables--user=mysql&`
|
||
|
|
||
|
3. 无密码登陆
|
||
|
`mysql -u root`
|
||
|
|
||
|
4. 修改密码
|
||
|
```sql
|
||
|
FLUSH PRIVILEGES;
|
||
|
ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';
|
||
|
EXIT;
|
||
|
```
|
||
|
|
||
|
5. 恢复正常mysql服务
|
||
|
```
|
||
|
sudo pkill mysqld
|
||
|
service mysql start
|
||
|
```
|