Home >Database >Mysql Tutorial >What to do if error code 1130 occurs in mysql

What to do if error code 1130 occurs in mysql

coldplay.xixi
coldplay.xixiOriginal
2020-11-02 15:46:3811784browse

The solution to error code 1130 in mysql: first log in to mysql; then find the "host" option in the "user" table in the mysql database; finally change from "localhost" to "%".

What to do if error code 1130 occurs in mysql

Solution to mysql error code 1130:

Error description:

Error code: 1130

Host ***.***.***.*** is not allowed to connect to this MySQL server

Solution:

1. Change the table:

Maybe Your account does not allow remote login, only localhost. At this time, as long as you log in to mysql on the localhost computer, change the "host" item in the "user" table in the "mysql" database from "localhost" to "%"

        mysql -u root -p
        mysql>use mysql;
        mysql>update user set host = ‘%' where user =’root’;
        mysql>flush privileges;
        mysql>select host,user from user where user=’root’;

You can do it now Connected!

2. Authorization method:

For example, if you want to root, use root to connect to the mysql server from any host.

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

If you want to allow user root to connect to the mysql server from the host with ip 192.168.1.3 and use root as the password

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.3' IDENTIFIED BY  'root' WITH GRANT OPTION;

Related free learning recommendations: mysql Video tutorial

The above is the detailed content of What to do if error code 1130 occurs in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn