Leif160519的blog Leif160519的blog

——————

目录
ubuntu安装mysql并且允许远程访问
/    

ubuntu安装mysql并且允许远程访问

1.安装mysql

sudo apt-get install mysql-client-core-5.7
sudo apt-get install mysql-server-5.7

2.修改配置文件

sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf找到bind-address = 127.0.0.1

改为: bind-address = 0.0.0.0,或者直接将其注解掉

允许任意IP访问;

之后重启mysql服务

sudo service mysql restart

3.修改表数据

登录mysql(root用户下密码为空)

mysql -u root -p

修改表数据

mysql> update mysql.user set host="%" where user="root";
mysql> update mysql.user set plugin="mysql_native_password" where user="root";
mysql> flush privileges;
mysql> quit;

大功告成!


“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill

标  题ubuntu安装mysql并且允许远程访问
作  者Leif160519
出  处https://github.icu/articles/2019/08/30/1567129276975.html
关于博主:坐标南京,运维工程师,如有问题探讨可以直接下方留言。
声援博主:如果您觉得文章对您有帮助,可以评论、订阅、收藏。您的鼓励是博主的最大动力!