Enable Mysql Access From Remote

To enable mysql access from remote machine, need to update some recods here:

1. Show user table contents

1
2
3
4
5
6
7
8
9
10
11
12
SELECT host,user,authentication_string FROM mysql.user;


Result will show like this:
+-----------+------------------+-------------------------------------------+
| host | user | authentication_string |
+-----------+------------------+-------------------------------------------+
| localhost | root | *AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
| localhost | mysql.session | *BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB |
| localhost | mysql.sys | *CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
| localhost | debian-sys-maint | *DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD |
+-----------+------------------+-------------------------------------------+

2. Update host to %(please update your user instead of updating root user)

1
2
3
4
5
Update mysql.user set host = '%' where user = 'root';


sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
comment out line [bind-address = 127.0.0.1]

3. Restart mysql

1
2
sudo services stop mysql
sudo services start mysql