浏览器家园·资讯

展开

MySql 5.7 重置root密码

编辑:浏览器知识

一、以安全模式登录

# Stop MySQL
sudo service mysql stop

# Make MySQL service directory.
sudo mkdir -p /var/run/mysqld

# Give MySQL user permission to write to the service directory.
sudo chown mysql:mysql /var/run/mysqld

# Start MySQL manually, without permission checks or networking.
sudo mysqld_safe --skip-grant-tables &

# Log in without a password.
mysql -u root

二、修改密码

UPDATE mysql.user SET authentication_string=PASSWORD('NEW-PASSWORD'), plugin='mysql_native_password' WHERE User='root' ;
EXIT;

三、重启数据库

# Turn off MySQL.
sudo mysqladmin -S /var/run/mysqld/mysqld.sock shutdown

# Start the MySQL service normally.
sudo service mysql start
文章TAG:mysql  重置  root  密码  MySql  重置root密码  

加载全部内容

相关教程
猜你喜欢
大家都在看