Error 1130 ошибка

This should be dead simple, but I cannot get it to work for the life of me.
I’m just trying to connect remotely to my MySQL server.

  • Connecting as:

    mysql -u root -h localhost -p  
    
  • works fine, but trying:

    mysql -u root -h 'any ip address here' -p
    
  • fails with the error:

    ERROR 1130 (00000): Host ‘xxx.xx.xxx.xxx’ is not allowed to connect to this MySQL server

In the mysql.user table, there is exactly the same entry for user ‘root’ with host ‘localhost’ as another with host ‘%’.

I’m at my wits’ end and have no idea how to proceed.
Any ideas are welcome.

Michael's user avatar

Michael

8,3966 gold badges61 silver badges88 bronze badges

asked Oct 13, 2009 at 12:40

concept47's user avatar

1

Possibly a security precaution. You could try adding a new administrator account:

mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
    ->     WITH GRANT OPTION;
mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
    ->     WITH GRANT OPTION;

Although as Pascal and others have noted it’s not a great idea to have a user with this kind of access open to any IP. If you need an administrative user, use root, and leave it on localhost. For any other action specify exactly the privileges you need and limit the accessibility of the user as Pascal has suggest below.

Edit:

From the MySQL FAQ:

If you cannot figure out why you get
Access denied, remove from the user
table all entries that have Host
values containing wildcards (entries
that contain ‘%’ or ‘_’ characters). A
very common error is to insert a new
entry with Host=’%’ and
User=’some_user’, thinking that this
allows you to specify localhost to
connect from the same machine. The
reason that this does not work is that
the default privileges include an
entry with Host=’localhost’ and
User=». Because that entry has a Host
value ‘localhost’ that is more
specific than ‘%’, it is used in
preference to the new entry when
connecting from localhost! The correct
procedure is to insert a second entry
with Host=’localhost’ and
User=’some_user’, or to delete the
entry with Host=’localhost’ and
User=». After deleting the entry,
remember to issue a FLUSH PRIVILEGES
statement to reload the grant tables.
See also Section 5.4.4, “Access
Control, Stage 1: Connection
Verification”.

answered Oct 13, 2009 at 12:47

Yannick Motton's user avatar

Yannick MottonYannick Motton

34.8k4 gold badges39 silver badges55 bronze badges

10

One has to create a new MySQL User and assign privileges as below in Query prompt via phpMyAdmin or command prompt:

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;

CREATE USER 'username'@'%' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;

FLUSH PRIVILEGES;

Once done with all four queries, it should connect with username / password

Andrey Mikhaylov - lolmaus's user avatar

answered Sep 16, 2013 at 5:56

Aditya P Bhatt's user avatar

Aditya P BhattAditya P Bhatt

21.5k19 gold badges85 silver badges104 bronze badges

9

My error message was similar and said ‘Host XXX is not allowed to connect to this MySQL server‘ even though I was using root. Here’s how to make sure that root has the correct permissions.

My setup:

  • Ubuntu 14.04 LTS
  • MySQL v5.5.37

Solution

  1. Open up the file under etc/mysql/my.cnf

  2. Check for:

    • port (by default this is port = 3306)
    • bind-address (by default this is bind-address = 127.0.0.1; if you want to open to all then just comment out this line. For my example, I’ll say the actual server is on 10.1.1.7)
  3. Now access the MySQL Database on your actual server (say your remote address is 123.123.123.123 at port 3306 as user root and I want to change permissions on database ‘dataentry’. Remember to change the IP Address, Port, and database name to your settings)

    mysql -u root -p
    Enter password: <enter password>
    mysql>GRANT ALL ON *.* to root@'123.123.123.123' IDENTIFIED BY 'put-your-password';
    mysql>FLUSH PRIVILEGES;
    mysql>exit
    
  4. sudo service mysqld restart

  5. You should now be able to remote connect to your database. For example, I’m using MySQL Workbench and putting in ‘Hostname:10.1.1.7’, ‘Port:3306’, ‘Username:root’

Manuel Jordan's user avatar

Manuel Jordan

15.3k21 gold badges95 silver badges159 bronze badges

answered Jun 11, 2014 at 19:31

Will's user avatar

WillWill

11.3k9 gold badges68 silver badges76 bronze badges

6

Just perform the following steps:

  1. Connect to MySQL (via localhost)

    mysql -uroot -p
    
    • If the MySQL server is running in Kubernetes (K8s) and being accessed via a NodePort

      kubectl exec -it [pod-name] -- /bin/bash
      mysql -uroot -p
      
  1. Create user

    CREATE USER 'user'@'%' IDENTIFIED BY 'password';
    
  2. Grant permissions

    GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' WITH GRANT OPTION;
    
  3. Flush privileges

    FLUSH PRIVILEGES;
    

Michael's user avatar

Michael

8,3966 gold badges61 silver badges88 bronze badges

answered Mar 24, 2014 at 9:27

minhas23's user avatar

minhas23minhas23

9,3013 gold badges58 silver badges40 bronze badges

6

You need to grant access to the user from any hostname.

This is how you add new privilege from phpmyadmin

Goto Privileges > Add a new User

enter image description here

Select Any Host for the desired username

enter image description here

answered Jun 21, 2013 at 11:42

HimalayanCoder's user avatar

HimalayanCoderHimalayanCoder

9,6406 gold badges59 silver badges60 bronze badges

1

Simple way:

Grant All Privileges ON *.* to 'USER_NAME'@'%' Identified By 'YOUR_PASSWORD'; 

then

FLUSH PRIVILEGES;

done!

answered Nov 24, 2018 at 8:05

devugur's user avatar

devugurdevugur

1,3491 gold badge19 silver badges25 bronze badges

4

The message *Host ''xxx.xx.xxx.xxx'' is not allowed to connect to this MySQL server is a reply from the MySQL server to the MySQL client. Notice how its returning the IP address and not the hostname.

If you’re trying to connect with mysql -h<hostname> -u<somebody> -p and it returns this message with the IP address, then the MySQL server isn’t able to do a reverse lookup on the client. This is critical because thats how it maps the MySQL client to the grants.

Make sure you can do an nslookup <mysqlclient> FROM the MySQL server. If that doesn’t work, then there’s no entry in the DNS server. Alternatively, you can put an entry in the MySQL server’s HOSTS file (<ipaddress> <fullyqualifiedhostname> <hostname> <- The order here might matter).

An entry in my server’s host file allowing a reverse lookup of the MySQL client solved this very problem.

answered Mar 13, 2012 at 13:37

Dennis McLaughlin's user avatar

1

This working for any future remote mysql connection !

    sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Navigate to the line that begins with the bind-address directive. It should look like this:

    bind-address            = 0.0.0.0

Login to your mysql as root terminal

    mysql -u root -p
    -- root password

    CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

    GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;

    CREATE USER 'username'@'%' IDENTIFIED BY 'password';

    GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;

    FLUSH PRIVILEGES;

    EXIT;

finally Grant that machine exclusive permission to connect to the database remotely with the following command.

    sudo ufw allow from remote_IP_address to any port 3306

answered Jun 3, 2020 at 13:14

soufiane ELAMMARI's user avatar

1

If you modify the grant tables manually (using INSERT, UPDATE, etc.), you should execute
a FLUSH PRIVILEGES statement to tell the server to reload the grant tables.

PS: I wouldn’t recommend to allow any host to connect for any user (especially not the root use). If you are using mysql for a client/server application, prefer a subnet address. If you are using mysql with a web server or application server, use specific IPs.

answered Oct 13, 2009 at 12:56

Pascal Thivent's user avatar

Pascal ThiventPascal Thivent

563k136 gold badges1063 silver badges1126 bronze badges

0

Just use the interface provided by MySql’s GUI Tool (SQLyog):

Click on User manager:
enter image description here

Now, if you want to grant access FOR ANY OTHER REMOTE PC, just make sure that, just like in the underneath picture, the Host field value is % (which is the wildcard)

enter image description here

answered Sep 27, 2017 at 13:09

BabaNew's user avatar

BabaNewBabaNew

8841 gold badge13 silver badges27 bronze badges

0

Most of the answers here show you creating users with two host values: one for localhost, and one for %.

Please note that except for a built-in localhost user like root, you don’t need to do this. If you simply want to make a new user that can log in from anywhere, you can use

CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypassword';
GRANT <whatever privileges are appropriate> ON <relevant tables> TO myuser;

and it will work just fine. (As others have mentioned, it’s a terrible idea to grant administrative privileges to a user from any domain.)

answered Oct 12, 2017 at 21:49

Erica Kane's user avatar

Erica KaneErica Kane

3,16226 silver badges36 bronze badges

If you are using MySQL WorkBench, you can achieve this easily:

  1. From the menu, select Server -> Users And Privileges
    enter image description here

  2. On the lower left, click on «Add account»
    enter image description here

  3. Fill the form with username, host matching (% means every host) and the password
    enter image description here

  4. Click on «Apply» on the lower right
    enter image description here

After this you are good to go. Then, if you want to refine your configuration, you can use the «Administrative Roles» tab to set the command that can be used by the user (SELECT, ALTER etc etc) and the «Schema privileges» tab to restrict the user interaction to specific schemas.

answered Mar 23, 2021 at 17:32

BabaNew's user avatar

BabaNewBabaNew

8841 gold badge13 silver badges27 bronze badges

Well, nothing of the above answer worked for me. After a lot of research, I found a solution. Though I may be late this may help others in future.

Login to your SQL server from a terminal

 mysql -u root -p
 -- root password
GRANT ALL ON *.* to root@'XX.XXX.XXX.XX' IDENTIFIED BY 'password';

This should solve the permission issue.

Before solving error

After solving issue

Happy coding!!

answered Nov 21, 2019 at 18:29

Pratap Sharma's user avatar

Pratap SharmaPratap Sharma

2,6432 gold badges18 silver badges32 bronze badges

simple way is to login to phpmyadmin with root account , there goto mysql database and select user table , there edit root account and in host field add % wild card . and then through ssh flush privileges

 FLUSH PRIVILEGES;

answered Feb 21, 2016 at 10:52

user889030's user avatar

user889030user889030

4,3733 gold badges49 silver badges51 bronze badges

1

If this is a recent mysql install, then before changing anything else, try simply to execute this command and then try again:

flush privileges;

This alone fixes the issue for me on Ubuntu 16.04, mysql 5.7.20. YMMV.

answered Nov 22, 2017 at 5:54

Alex R's user avatar

Alex RAlex R

11.4k15 gold badges100 silver badges181 bronze badges

Just find a better way to do that from your hosting control panel (I’m using DirectAdmin here)

simply go to the target server DB in your control panel, in my case:
MySQL management -> select your DB -> you will find: «Access Hosts», simply add your remote host here and its working now!
enter image description here

I guess there is a similar option on other C.panels like plesk, etc..

I’m hope it was helpful to you too.

answered May 19, 2018 at 6:35

Eran Levi's user avatar

Eran LeviEran Levi

8772 gold badges12 silver badges31 bronze badges

I was also facing same issue, It resolved in 2 min for me i just white list ip through cpanel

Suppose you are trying to connect database of server B from server A.
Go to Server B Cpanel->Remote MySQL-> enter Server A IP Address and That’s it.

answered Dec 4, 2014 at 22:37

user3437729's user avatar

If you happen to be running on Windows; A simple solution is to run the MySQL server instance configuration wizard. It is in your MYSQL group in the start menu. On the second from last screen click the box that says «allow root access from remote machines».

answered Jun 22, 2016 at 14:18

Jan's user avatar

JanJan

3304 silver badges12 bronze badges

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

this error because no password to the root , and this Maybe occurred with you when you trying to connect from outside .

answered Mar 20, 2019 at 21:20

Abd Abughazaleh's user avatar

Abd AbughazalehAbd Abughazaleh

4,6353 gold badges44 silver badges55 bronze badges

0

If you have WAMP Server + Windows 10 and you are using it for development than Right Click on Wamp Icon => Wamp Settings => Check Allow Virtual Hosts other than 127*
enter image description here

answered May 8, 2020 at 9:59

Adrian's user avatar

AdrianAdrian

2,2734 gold badges38 silver badges78 bronze badges

Well what you can do is just open mysql.cfg file and you have to change Bind-address to this

bind-address = 127.0.0.1

and then Restart mysql and you will able to connect that server to this.

Look this you can have idea form that.

this is real sol

answered Feb 4, 2014 at 7:31

Kishan Bheemajiyani's user avatar

3

This answer might help someone…

All these answers didnt help, then I realised I forgot to check one crucial thing.. The port :)

I have mysql running in a docker container running on a different port. I was pointing to my host machine on port 3306, which I have a mysql server running on. My container exposes the server on port 33060. So all this time, i was looking at the wrong server! doh!

answered May 16, 2018 at 22:21

Srini's user avatar

SriniSrini

4465 silver badges11 bronze badges

This working for DirectAdmin;

  1. Go to your DirectAdmin.
  2. Go to your MySQL Management.
  3. Select your database.
  4. Under your Accesse Host tab, there is a field.
    You should fill this field by xxx.xx.xxx.xx.
  5. Click on Add Host.

Finished. Now you can access to this DB by your your_database_username & your_database_password.
So Simple!

answered Dec 10, 2018 at 7:37

اسماعیل زارع's user avatar

CPANEL solution

Go to Cpanel, look for Remote MySQL.
Add the the IP in the input field:

Host (% wildcard is allowed)

Comment to remember what IP that is.
That was it for me.

answered Apr 29, 2019 at 3:00

user2060451's user avatar

user2060451user2060451

2,5763 gold badges24 silver badges31 bronze badges

1. From a terminal, connect you to your MySQL running container

docker exec -it your_container_name_or_id bash

2. In your container, connect you to the MySQL database

mysql -u your_user -p

enter your password to connect to database.

3. execute this SQL script to list all existing database users:

SELECT host, user FROM mysql.user;

The result will be some thing like below:

host user
127.0.0.1 root
::1 root
localhost mysql.sys
localhost root

you should add a new row:

CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;

answered Jul 21, 2022 at 13:28

Ali Tofigh's user avatar

Problem: root@localhost is unable to connect to a fresh installation of mysql-community-server on openSUSE 42.2-1.150.x86_64.
Mysql refuses connections — period.

Solution:

$ ls -l /var/lib/mysql/mysql/user.*
-rw-rw---- 1 mysql mysql     0 Apr 29 19:44 /var/lib/mysql/mysql/user.MYD
-rw-rw---- 1 mysql mysql  1024 Apr 29 19:44 /var/lib/mysql/mysql/user.MYI
-rw-rw---- 1 mysql mysql 10684 Apr 29 19:44 /var/lib/mysql/mysql/user.frm

File user.MYD has 0 size (really ?!).
I copied all 3 files from another working system.

$ /usr/sbin/rcmysql stop
$ cd /var/lib/mysql/mysql/
$ scp root@othersytem:/var/lib/mysql/mysql/user.* ./
$ /usr/sbin/rcmysql start
$ cd -
$ mysql -u root -p

I was able to log in. Then, it was just a matter of re-applying all schema privileges.
Also, if you disabled IPv6, re-enable it temporary so that root@::1 account can also work.

answered Apr 30, 2018 at 3:43

Alex D's user avatar

Some tips:

  • list privileges using show grants;
  • create a VPN and just add the ip of the tunnel

answered Feb 21 at 17:49

Fabrice salvaire's user avatar

if you are trying to execute mysql query withouth defining connectionstring, you will get this error.

Probably you forgat to define connection string before execution. have you check this out?
(sorry for bad english)

answered Aug 31, 2015 at 7:17

Ali CAKIL's user avatar

Ali CAKILAli CAKIL

3835 silver badges21 bronze badges

All of the answers here didn’t work in my case so I guest this may help other users in the future. This can also be a problem in our code, not just in MySQL alone.

If you are using VB.NET

Instead of this code:

 Dim server As String = My.Settings.DB_Server
 Dim username As String = My.Settings.DB_Username
 Dim password As String = My.Settings.DB_Password
 Dim database As String = My.Settings.DB_Database

 MysqlConn.ConnectionString = "server=" & server & ";" _
 & "user id=" & username & ";" _
 & "password=" & password & ";" _
 & "database=" & database

 MysqlConn = New MySqlConnection()

You need to move MysqlConn = New MySqlConnection() on the first line. So it would be like this

 MysqlConn = New MySqlConnection()

 Dim server As String = My.Settings.DB_Server
 Dim username As String = My.Settings.DB_Username
 Dim password As String = My.Settings.DB_Password
 Dim database As String = My.Settings.DB_Database

 MysqlConn.ConnectionString = "server=" & server & ";" _
 & "user id=" & username & ";" _
 & "password=" & password & ";" _
 & "database=" & database

answered Jul 21, 2015 at 5:14

Cary Bondoc's user avatar

Cary BondocCary Bondoc

2,9334 gold badges37 silver badges60 bronze badges

1

Application developers may encounter difficulties connecting to a database hosted on a server other than the local server. In this article, we will resolve a common error that occurs when connecting to a MySQL database remotely from outside the network or from another host.

SQLSTATE[HY000] [1130] Host '172.19.0.11' is not allowed to connect to this MySQL server error occurs when the connection request is rejected by the MySQL server. By default, the MySQL server only accepts connections from local hosts and not from other hosts.

To enable the remote connections, we need to do the following steps –

  1. Enable remote connections from the config
  2. Create a new user and allow it to connect to the database server from the specific host (or all hosts)
  3. Flush privileges

Enable Remote connections from MySQL config

Open the MySQL config using your favorite text editor, such as nano. The MySQL file is usually located at /etc/mysql/my.cnf or /etc/my.cnf or /etc/mysql/mysql.conf.d/mysqld.cnf. The location of the MySQL configuration file depends on the version of MySQL you’re using. Check all of these locations to see if you can find the configuration file. Please join our Discord server and let us know if you haven’t found the config file yet. Perhaps we can assist you.

Once found the config file, open it and comment out the line bind-address = 127.0.0.1.

Just add # before the line to comment it out.

# bind-address = 127.0.0.1

Create new MySQL user

We create a mysql user with the host as ‘localhost’ for local use, but when adding a user for remote connections, we must replace the localhost with the IP address of the remote computer.

Login to MySQL as root –

sudo mysql

Or

mysql -u root -p

Depending on the method you select, you will be prompted to enter your password. If you’re using the second method, enter the MySQL root user’s password, or the sudo password if you’re logging in with sudo.

Once in the MySQL command-line, create a new user –

> CREATE USER 'username'@'ip-address' IDENTIFIED BY 'set-password';

You should see the following message if the new user is created –

Query OK, 0 rows affected (0.02 sec)

We will now give the newly created user permissions to manage a specific database on the server. We can also give this user access to all of the databases on the server, but this is not recommended. I recommend that you create a new database(s) for your application(s) and grant this user permissions to manage the database(s).

> GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'ip-address';

Once done, please flush the privileges for the changes to take effect.

> FLUSH PRIVILEGES;

Allow all remote connections

As in the preceding command, I instructed to replace the ip-address with the remote computer’s IP address. Only connections from that remote computer will be permitted. However, we can also use the ‘%’ wildcard to allow all connections, regardless of whether they are from your computer or from that basement guy who needs access to your database for personal reasons. 😉 They will, however, need to enter the correct credentials to access the database.

> GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'%';

If your database server is in production, it is highly recommended to not use ‘%’ wildcard.

Allow connections from a range of IP address

If the remote servers are on the same network, their IP addresses can easily be allowed to allow remote connections without the need for multiple MySQL users.

> GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'172.19.0.*';

Notice how the last octet of the IP address has been replaced with * in the above command. This allows all servers with that IP address to begin with 172.19.0.

d16304f3150e5897f973a7a8e3583358

Mohd Sohail is a web developer and a Linux sysAdmin. He also loves to write how-to articles, applications reviews and loves to use new Linux distributions.

915 Posts

In this quick article, you will learn how to solve the “ERROR 1130 (HY000): Host x.x.x.x is not allowed to connect to this MySQL server” error in MySQL/MariaDB database deployment on a Linux system. This is one of the common remote database connection errors encountered by users.

Test Environment:

  • Application Server IP: 10.24.96.5
  • Database Server IP: 10.24.96.6

We encountered the error while testing database connection from one of our app servers to a database server, using the mysql client as shown.

# mysql -u database_username -p -h 10.24.96.6

MySQL Remote Database Connection Error

MySQL Remote Database Connection Error

The error indicates that the host 10.24.96.5 that the database user is connecting from is not allowed to connect to the MySQL server. In this case, we have to make some changes to the database server to enable the user to connect remotely.

On the database server, we have to check the host the user above is allowed to connect from.

# mysql -u root -p

Run the following SQL commands to check the user’s host:

MariaDB [(none)]> SELECT host FROM mysql.user WHERE user = "database_username";

Check MySQL User Host

Check MySQL User Host

From the output of the command, the user is only allowed to connect to the database server from the localhost. So, we need to update the user’s hosts as follows.

Run the following GRANT command to enable MySQL access for the remote user from a remote host. Make sure to replace “10.24.96.6” with the IP address of the remote system, and “database_password” to the password that you want “database_username” to use:

MariaDB [(none)]> GRANT ALL ON database_name.* to 'database_username'@'10.24.96.5' IDENTIFIED BY 'database_password';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> SELECT host FROM mysql.user WHERE user = "database_username";

Enable Remote MySQL Database Access to User from Remote Host

Enable Remote MySQL Database Access to User from Remote Host

To give a user remote access from all host on a network, use the syntax below:

MariaDB [(none)]> GRANT ALL ON database_name.* to 'database_username'@'10.24.96.%' IDENTIFIED BY 'database_password';

After making the above changes, try to remotely connect to the MySQL database server once more. The connection should be successful as shown in the following screenshot.

# mysql -u database_username -p -h 10.24.96.6

Connect to Remote MySQL Database Server

Connect to Remote MySQL Database Server

We hope this solution helped you in solving your Mysql remote connection error. If have any queries reach us via the feedback form below.

Receiving ‘MySQL error 1130’? We can help you in fixing it. 

Normally, the error code 1130 pops up when trying to access the MySQL servers.

At Bobcares, we receive requests to fix the MySQL errors as a part of our Server Management Services.

Today, let’s know the causes of this error and see how our Support Engineers fix it in MYSQL servers.

Why does MySQL error 1130 occur?

We’ve seen many of our customers experiencing this error message while accessing the MySQL servers.

The error code 1130 normally occurs if there is any networking problem.

Now, let’s go through the main reasons for this error message to appear.

1. If the server is not able to resolve the hostname of the client.

2. In case if the host isn’t allowed to connect to the MySQL server.

The error message appears as:

MySQL error code 1130

How we fix MySQL error 1130?

Till now, we discussed the reasons for this error to occur. Now, let’s see how our Support Engineers fix this error for our customers.

Recently, one of our customers approached us with the same error message.

Allow access permission to the IP-Address of the client.

Basically, this means we are allowing permission to specific IP addresses to access the MYSQL server.

For this, we run the below command to grant the permissions to the database.

grant all on db.* to 'username'@'192.168.0.1';

Finally, this fixed the error message.

Allow users from any network.

To allow users from any network, we perform the below steps.

Initially, we access the configuration file which is located in the path /etc/mysql/my.cnf.

vi /etc/mysql/my.cnf

Then we comment the below lines within the configuration file

#bind-address = 127.0.0.1
#skip-networking

Then we restart the MySQL server

service mysql restart

Finally, we login to MySQL and change the grant privileges. For that, we run the below command.

GRANT ALL ON *.* to root@'%' IDENTIFIED BY 'root_password';

Also, we ensure that the customers MySQL port 3306 is opened which is the default port of MySQL Database Server.

This resolves the error effectively.

[Need any further assistance with MySQL errors? – We’ll help you]

Conclusion

Today, we saw the causes of the error “Mysql error 1130: Host is not allowed to connect to this MySQL server” and saw how our Support Engineers fix it for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

Many times we faced below issue when try to connect a remote MySQL server from client system and remote client is not allowed to access this MySQL server we faced issue like below.

# mysql -h 192.168.1.10 -u root -p
Enter password:
[Output]

ERROR 1130 (HY000): Host '192.168.1.12' is not allowed to connect to this MySQL server

This issue is because that, If client system does not have permission to connect MySQL server. By default MySQL server doesn’t allow any remote clients to connect.

Allow MySQL Client Connection:

To allow a client system to connect mysql server. Login to remote mysql server using ssh and then login to MySQL server locally. Now use following commands to allow remote client. For example if remote client’s ip is 192.168.1.12 and trying to connect through mysql root account.

[ Below commands need to run on MySQL Server ]

# mysql -u root -p
Enter password:

mysql> GRANT ALL ON *.* to root@'192.168.1.12' IDENTIFIED BY 'new-password';
mysql> FLUSH PRIVILEGES;
mysql> quit

You have successfully created a new account in MySQL server to connect from specified client system.

Let’s try to connect from clients system.

# mysql -h 192.168.1.10 -u root -p

[Sample Output] 
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 27
Server version: 5.1.69 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>

Понравилась статья? Поделить с друзьями:
  • Err cue ошибка тонометра
  • Epson ошибка 42h
  • Er05 ошибка scher khan при автозапуске что делать
  • Epson ошибка 1а39
  • Epson ошибка 1a36