Solve the connection between the client and the remote server (MySQL): XXX. XXX is not allowed to connect to this MySQL Server

Source: Internet
Author: User
Switch from csdn, but the original post has something wrong. I corrected it a little.

1. Create a new user, floydlee.
[Root @ rainfish root] # useradd-G MySQL floydlee
[Root @ rainfish root] # MySQL
 
2. Enter mysql. Format: grant permission on database name. Table name user @ login host identified by "User Password ";
Grant select, update, insert, delete on *. * To floydlee@10.187.82.130 identified by "floydlee ";
View the result and execute:
Use MySQL;
Select host, user, password from user;
You can see that the created floydlee user already exists in the User table. The Host field indicates the host to log on to. The value can be an IP address or a host name,
Changing the Host field value to % indicates that any client machine can log on to the MySQL server as a floydlee user. We recommend that you set the value to % during development.
Update user set host = '%' where user = 'floydlee ';
2. log out of MySQL.
[Root @ rainfish root] # mysqladmin-uroot-P (password) Reload (-P is not required if there is no password)
[Root @ rainfish root] # mysqladmin-uroot-P (password) Shutdown
A. [root @ rainfish root] # mysqld_safe -- user = root &
Remember: Any modification to the authorization table must be reload again, that is, step a is executed.
(Since the above two steps can be connected, the following is useless, but it is still written for your reference)
If you still cannot connect from the client after the above three steps, perform the following operations to insert a record in the DB table of the MySQL database:
Use MySQL;
Insert into DB values ('2017. 168.88.234 ',' % ', 'xuys', 'y ', 'y', 'y ');
Update dB set host = '%' where user = 'xuys ';
Repeat Step 1 above.

Another document:
MySQL: Unable to remotely log on to MySQL Server

Log on to the MySQL server using the MySQL Adminstrator GUI tool, but the server returns the error message host '60-248-32-13.hinet-ip.hinet.net 'is not allowed to connect to this
MySQL Server

This is because of permission issues. The solution is as follows:
Shell> MySQL -- user = root-P
Enter Password
Mysql> use MySQL
Mysql> grant select, insert, update, delete on [db_name]. * to [username] @ [ipadd] identified by '[Password]';

[Username]: User code for remote login
[Db_name]: indicates the name of the database to be opened to the user.
[Password]: User Password for remote login
[Ipadd]: The DNS name after IP address or IP address reverse lookup. In this example, enter '60-248-32-13.hinet-ip.hinet.net '. Enclose the quotation marks (')

(In fact, it is executed on the remote server. Fill in the IP address of the local host .)

If you want to open all permissions, execute:
Mysql> Update user set select_priv = 'y', insert_priv = 'y', update_priv = 'y', delete_priv = 'y', create_priv = 'y ', drop_priv = 'y', reload_priv = 'y', shutdown_priv = 'y', process_priv = 'y', file_priv = 'y', grant_priv = 'y ', references_priv = 'y', index_priv = 'y', alter_priv = 'y', show_db_priv = 'y', super_priv = 'y', create_tmp_table_priv = 'y ', lock_tables_priv = 'y', execute_priv = 'y', repl_slave_priv = 'y', repl_client_priv = 'y' where user = '[username]';

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.