ubuntu18.04下安装MySQL5.7
更新源
sudo apt update
安装mysql
sudo apt install mysql-server
使用sudo mysql进入数据设置root账户的密码和权限
sudo mysql
修改密码
show databases;
use mysql;
show tables;
update user set plugin='mysql_native_password' where user='root';
update user set authentication_string=PASSWORD('你要修改的密码') where user=‘root’;
FLUSH PRIVILEGES; # 刷新权限
\q # 退出
重新进入mysql
mysql -u root -p
grant all on *.* to root@'%' identified by '123456'; # 为root用户授权
修改远程访问
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
:set nu # 大于在43行左右
注释掉# bind-address = 127.0.0.1
# 重启
sudo service mysql restart
-------------------------------------------
个性签名:代码过万,键盘敲烂!!!
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!