Server connection error host 'xxx' is not allowed to connect to this MySQL Server

Source: Internet
Author: User

Host 'local' is not allowed to connect to this MySQL Server typical remote permission issues. The crux of the problem is that MySQL does not have the permission to enable remote logon.

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 a Linux host, enter the following command in the command prompt line:

 

> Mysql-uroot-p123456
  • >
    MySQL
    -
    Uroot
    -
    P123456

123456 is the password of the root user.

2) create a remote login user and authorize

 

> Grant all privileges on discuz. * to TED @ '2017. 123.123.123 'identified by '123 ';
  • >
    Grant all privileges on discuz
    .*
    To Ted
    @
    '123.123.123'
    Identified
    '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 target permission. discuz indicates the database, followed *
Indicates that all tables are authorized as "*. * ", authorize all tables of a database to" database name. * ", for a table in a database
The permission is "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.

> Flush privileges;
  • >
    Flush privileges
    ;
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.