Part-1: Ubuntu
install
1 2 3 4
| sudo apt-get install mysql-server
mysql -uroot -pxxx
|
allow remote access
change bind-address
1 2 3
| 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
1 2 3 4 5 6 7 8
| vim ./mysql.conf.d/mysqld.cnf bind-address = 0.0.0.0
sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/mysql.conf.d/mysqld.cnf
service mysql restart
|
grant users
1 2
| mysql> grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option; mysql> flush privileges;
|
check for users.
1 2 3 4 5 6 7 8 9 10 11 12
| 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
1
| mysql -uroot -p123456 -h 192.168.0.130
|
Part-2: Windows
install mysql server 5.7
OK
allow remote access
grant users
1 2 3 4 5 6 7 8 9 10 11
| mysql> grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option; mysql> flush privileges; ```
close fireware and allow 3306 tcp connection.
```bash mysql -uroot -p123456 -h 192.168.0.130
|
or by mysql client.
Reference
History
- 20180124: created.
- 20180308: add windows part.