The first step:
Modifying a configuration file
sudo vi/etc/mysql/mysql.conf.d/mysqld.cnf
Find bind-address = 127.0.0.1
Comment out this line, such as: #bind-address = 127.0.0.1
or instead: Bind-address = 0.0.0.0
Allow any IP access;
Or specify an IP address yourself.
When editing is complete, enter: wq!
Save Exit Edit!
Step Two:
Log in to MySQL
>mysql-uroot-p123456
Then, switch to MySQL database. SQL is as follows:
The code is as follows:
>use MySQL;
Just want to modify an existing user (for example, root) to allow remote host access, you can use the following SQL to complete:
>update user set host= '% ' where user= ' root ' and host= ' localhost ';
Exit database
>mysql> exit;
Once you have completed all of the above steps, you will need to restart the database for the modified configuration to take effect. Execute the following command to restart the database
>sudo service MySQL restart;
Congratulations you have completed the configuration, you can try to remotely operate the MySQL database
MySQL settings under Ubunt allow remote connections