MySQL Remote connection Host * is not allowed to connect to this MySQL server

Source: Internet
Author: User
Tags flush

Mysql-u root-p

Mysql>use MySQL;

Mysql>update User Set host = '% ' where user = ' root ';

Mysql>flush privileges;

mysql> use MySQL

Reading table information for completion of table and column names

Can turn off this feature to get a quicker startup with-a

Database changed

mysql> Update user Set Password=password (' root123 ') where user= ' root ' and host= ' localhost '

;

Query OK, 1 row Affected (0.00 sec)

Rows matched:1 changed:1 warnings:0

Mysql> Select ' Host ' from user where user= ' root '

;

+------+

| Host |

+------+

| Host |

| Host |

| Host |

| Host |

+------+

4 rows in Set (0.00 sec)

Mysql> GRANT All privileges on * * to ' root ' @ '% ' identified by ' root123 ' with GRANT OPTION;

Error 1064 (42000): You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use near '% ' identified by ' root123 ' With GRANT OPTION ' at line 1

Mysql> Grant all privileges on * * to ' root ' @ '% ' identified by ' root123 ' with GRANT option;

Query OK, 0 rows Affected (0.00 sec)

mysql> Update user set host= '% ' where user= ' root '

Flush privileges;

Error 1064 (42000): You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near ' flush-privileges ' at line 2

mysql> flush Privileges;

Query OK, 0 rows Affected (0.00 sec)

Mysql> Select host from user where user= ' root '

;

+-----------------------+

| Host |

+-----------------------+

| %                     |

| 127.0.0.1 |

| :: 1 |

| localhost |

| Localhost.localdomain |

+-----------------------+

5 rows in Set (0.00 sec)

mysql> Update user set host= '% ' where user= ' root ';

ERROR 1062 (23000): Duplicate entry '%-root ' for key ' PRIMARY '

mysql> flush Privileges;

Query OK, 0 rows Affected (0.00 sec)

Mysql> Select Host,user from user where user= ' root '

;

+-----------------------+------+

| Host | user |

+-----------------------+------+

| % | root |

| 127.0.0.1 | root |

| :: 1 | root |

| localhost | root |

| Localhost.localdomain | Root |

+-----------------------+------+

5 rows in Set (0.00 sec)

Mysql>

MySQL Remote connection Host * is not allowed to connect to this MySQL server

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.