MySQL implements remote login, and mysql implements remote login.
Cause analysis:
Host 'local' is not allowed to connect to this MySQL server typical remote permission issues.
Problem:
MySQL does not have the permission to enable remote logon. It depends on the system used by your server, such as linux or Windows. This solution is different. You can search for it online and there are a lot of materials to solve the problem.
Solution:
There are two major steps to enable the MySQL remote login account:
1. Check whether the firewall on the server does not block port 3306.
The default port of MySQL is 3306. Make sure that the firewall does not block port 3306. Otherwise, the remote connection to MySQL cannot be established through port 3306.
If you specify another port when installing MySQL, enable the port used by MySQL in the firewall.
If you do not know how to set up a firewall on your server, contact your server administrator.
2. Added support for remote connection to MySQL users and authorization.
1) first log on to MySQL with the root account
On the Windows host, click the Start Menu, run, enter "cmd", enter the console, MySQL bin directory, and then enter the following command.
On the Linux host, enter the following command in the command prompt line.
Copy codeThe Code is as follows:
> MySQL-uroot-p123456
123456 is the password of the root user.
2) create a remote login user and authorize
Copy codeThe Code is as follows:
> Grant all PRIVILEGES on discuz. * to ted @ '2017. 123.123.123 'identified by '123 ';
The preceding statement grants all permissions of the discuz database to the ted user, allows the ted user to remotely log on to the IP address 123.123.123.123, and sets the ted user password to 123456.
The following describes all the parameters one by one:
All PRIVILEGES indicates that all permissions are granted to the specified user. Here, you can also replace it with a specific permission, such as select, insert, update, delete, create, and drop, separate specific permissions with commas.
Discuz. * Indicates the table to which the preceding Permission applies. discuz indicates the database, and * indicates all the tables. Therefore, we can infer that: authorize "*. * ", authorize all tables of a database to" database name. * ", authorize a table of a database as" database name. table name ".
Ted indicates the user you want to authorize. This user can be an existing user or a non-existing user.
123.123.123.123 indicates the IP address that allows remote connection. If you want to restrict the IP address, set it to "%.
123456 is the user's password.
After the preceding statement is executed, the following statement can take effect immediately.
Copy codeThe Code is as follows:
> Flush privileges;