ubantu 安装mysql 5.7 解决安装不提示设置密码问题

时间:2021-10-30 10:27:01
1、安装Mysql

sudo apt-get install mysql-server

sudo apt-get install mysql-client

sudo apt-get install libmysqlclient-dev

2、修改root密码

sudo more /etc/mysql/debian.cnf

用文件里的用户名密码登陆Mysql

use mysql

update user set plugin='mysql_native_password' where user='root';

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

flush privillege;

3、配置远程访问

注释掉在/etc/MySQL/mysql.conf.d/mysqld.cnf里面的bind-address = 127.0.0.1

连接mysql数据库,修改user表

Grantall on *.* to 'root'@'%' identifiedby 'root用户的密码' withgrant option;flush privileges;