The first step:
Vim/etc/mysql/my.cnf Found 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.
Restart MySQL:sudo/etc/init.d/mysql Restart
Step Two:
Authorized users can connect remotely
Grant all privileges on * * to [email protected] '% ' identified by ' password ' with GRANT option;
flush Privileges;
The first line of the command is interpreted as follows, * *: The first * represents the database name, and the second * represents the table name. This means that all tables in the database are licensed to the user. Root: Grant root account. "%": indicates that the authorized user IP can be specified, which means that any IP address can access the MySQL database. "Password": Assign the password of the account, here the password itself is replaced with your MySQL root account password.
The second line of command is to refresh the permission information, that is, let our settings take effect immediately.
Allow Ubuntu to connect remotely under MySQL