mysql -5.7.31 修改root密码 亲测

it2023-03-06  80

安装:

sudo apt install mysql-server mysql-client libmysqlclient-dev -y

版本号:mysql -V

mysql  Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using  EditLine wrapper

root@ubuntu18:/etc/mysql# history      1  vim mysql.conf.d/mysqld.cnf    #   新增一行 skip-grant-tables=1     3  /etc/init.d/mysql restart   # 注释掉重启     

# 无密码进入 

update user set authentication_string=password('12345678') where user='root'; flush privileges;

 #    4  mysql -uroot -p   输入 '12345678' 进入

grant all on *.* to 'root'@localhost identified by 'root';

 

最新回复(0)