mysql 重置密碼

mysql 重置密碼,跳過登陸修改密碼:mysql

# centos 7 上mysql 已經更名了,啓動服務的時候注意是mariadb 了!!!!!

# 1
systemctl stop mariadb

# 2
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"

# 3
systemctl start mysqld

# 4 直接登陸,無密碼
mysql -u root

# 5
update user set password=password("new_password") where user='root';

# 6 
FLUSH PRIVILEGES;

# 7
quit

#8
systemctl stop mariadb

#9
systemctl unset-environment MYSQLD_OPTS

#10
systemctl start mysqld

#11
 mysql -u root -p
相關文章
相關標籤/搜索