ubuntu 16.04 和 windows 10系统安装mysql 允许远程访问 | mysql user guide on ubuntu 16.04 and windows 10

ubuntu 16.04 和 windows 10系统安装mysql 允许远程访问 | mysql user guide on ubuntu 16.04 and windows 10本文首发于个人博客https://kezunlin.me/post/36e618e7/,欢迎阅读! mysql user guide on ubuntu 16.04 and windows 10 P…

本文首发于个人博客https://kezunlin.me/post/36e618e7/,欢迎阅读!

mysql user guide on ubuntu 16.04 and windows 10

Part-1: Ubuntu

install

sudo apt-get install mysql-server
# root,123456

mysql -uroot -p123456

代码100分

allow remote access

change bind-address

代码100分cd /etc/mysql
grep -r "bind-address" .
./mysql.conf.d/mysqld.cnf:bind-address          = 127.0.0.1

change bind-address to 0.0.0.0

vim ./mysql.conf.d/mysqld.cnf
bind-address          = 0.0.0.0

# or 
sed -i "s/127.0.0.1/0.0.0.0/g" /etc/mysql/mysql.conf.d/mysqld.cnf

# restart
service mysql restart

grant users

代码100分mysql> grant all privileges on *.* to "root"@"%" identified by "123456" with grant option;
mysql> flush privileges;

check for users.

mysql> use mysql;
mysql> select user,host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| root             | %         |
| debian-sys-maint | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+
5 rows in set (0.00 sec)

OK. Now we can access mysql from remote machine.

Test connection

mysql -uroot -p123456 -h 192.168.0.130

Part-2: Windows

install mysql server 5.7

OK

allow remote access

grant users

mysql> grant all privileges on *.* to "root"@"%" identified by "123456" with grant option;
mysql> flush privileges;

close fireware

close fireware and allow 3306 tcp connection.

Test connection

mysql -uroot -p123456 -h 192.168.0.130

or by mysql client.

Reference

History

  • 20180124: created.
  • 20180308: add windows part.

Copyright

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/11038.html

(0)
上一篇 2022-12-17
下一篇 2022-12-17

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注