一点飞鸿影下

孤村落日残霞,轻烟老树寒鸦,一点飞鸿影下。 青山绿水,白草红叶黄花。

导航

ubuntu18.04中mysql的安装及远程连接配置

1.ubuntu 18.04 下mysql的安装

sudo apt install mysql-server

2.mysql 安装配置

sudo mysql_secure_installation

参考配置

#1
VALIDATE PASSWORD PLUGIN can be used to test passwords...
Press y|Y for Yes, any other key for No: N (我的选项)

#2
Please set the password for root here...
New password: (输入密码)
Re-enter new password: (重复输入)

#3
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them...
Remove anonymous users? (Press y|Y for Yes, any other key for No) : N (我的选项)

#4
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network...
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y (我的选项)

#5
By default, MySQL comes with a database named 'test' that
anyone can access...
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N (我的选项)

#6
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y (我的选项)

3.配置root用户远程访问

GRANT ALL PRIVILEGES ON *.* TO 'root'@"%" IDENTIFIED BY "123456"; 

4.这个时候可能远程访问还是有问题,拒绝链接(111)

这时需要找到配置文件中的这一行,把它注释掉(这个让我搞了一晚上)

#bind-address            = 127.0.0.1

此时就可以成功远程链接了。

posted on 2019-05-23 03:12  一点飞鸿影下  阅读(261)  评论(0编辑  收藏  举报