ubuntu mysql 安装、远程、配置

1. 安装

apt install mysql-server
apt install mysql-client

安装后,配置文件会在/etc/mysql里面,

2 远程配置

首先配置密码,可以参考这里 在Ubuntu 18.04 下安装mysql,没有初始密码,重设root密码
也可以直接进入Mysql,然后给root改密码

sudo mysql -u root

然后开始配置远程
在MySQL表里:

GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '密码' WITH GRANT 
update user set authentication_string =password('root'),plugin='msyql_native_password' where user='root';OPTION;
FLUSH PRIVILEGES;

还要更改一下配置文件的IP限制

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

blind-address的部分注释掉
最后重启mysql服务
service mysql restart

3. 可能出现的防火墙问题

ubuntu 防火墙UFW

1698 Access denied for user root@localhost错误解决方法

参考这里的解决方案

4. 其他错误

ERROR 1524 (HY000): Plugin ‘msyql_native_password’ is not loaded(Ubuntu)
https://blog.csdn.net/nageaixiaodenanhai/article/details/89319444
在/etc/mysql/my.cnf中添加

[mysqld]
skip-grant-tables

猜你喜欢

转载自blog.csdn.net/Defiler_Lee/article/details/120921683
今日推荐