Mysql error number 1130

MySQL error code 1130 mainly occurs when the server cannot resolve the hostname of the client or host is not allowed to connect to the MySQL server.

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»;

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.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

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.

Страницы 1 2 Далее

Чтобы отправить ответ, вы должны войти или зарегистрироваться

Лента темы в RSS

Сообщения с 1 по 25 из 27

1 2007-02-18 12:53:42

  • Nixtone
  • Nixtone
  • Участник
  • Неактивен
  • Зарегистрирован: 2007-02-16
  • Сообщений: 38

Тема: 1130 ошибка при соединении с сервером MySQL

Реально вообще настроить pma?

phpMyAdmin попытался соединиться с сервером MySQL, но сервер отверг соединение. Проверьте имя хоста, пользователя и пароль в config.inc.php.

Ошибка
Ответ MySQL:
#1130 — Host ‘localhost’ is not allowed to connect to this MySQL server

что делать???

Человек способен поверить во всё что угодно, кроме правды…

2 Ответ от Lokki 2007-02-18 15:46:37

  • Lokki
  • Lokki
  • Админ
  • Неактивен
  • Откуда: Москва
  • Зарегистрирован: 2006-01-25
  • Сообщений: 910

Re: 1130 ошибка при соединении с сервером MySQL

Nixtone сказал:

Реально вообще настроить pma?

Вполне.

Nixtone сказал:

что делать???

Например, воспользоваться поиском по форуму:
http://forum.php-myadmin.ru/viewtopic.php?id=289

Нет неразрешимых проблем, есть неприятные решения. (Э. Борн)

3 Ответ от Nixtone 2007-02-18 21:06:06

  • Nixtone
  • Nixtone
  • Участник
  • Неактивен
  • Зарегистрирован: 2007-02-16
  • Сообщений: 38

Re: 1130 ошибка при соединении с сервером MySQL

ничё толком не нашол, самое похожее это было настройка для удалённого, а я у меня местный (localhost)

Человек способен поверить во всё что угодно, кроме правды…

4 Ответ от Lokki 2007-02-18 22:16:21

  • Lokki
  • Lokki
  • Админ
  • Неактивен
  • Откуда: Москва
  • Зарегистрирован: 2006-01-25
  • Сообщений: 910

Re: 1130 ошибка при соединении с сервером MySQL

Nixtone сказал:

ничё толком не нашол, самое похожее это было настройка для удалённого, а я у меня местный (localhost)

Кофе закончился, поэтому прошу всё-таки продемонстрировать свой конфигурационный файл. И убедись, что твой виртуальный хост http://localhost/ функционирует.

Нет неразрешимых проблем, есть неприятные решения. (Э. Борн)

5 Ответ от Nixtone 2007-02-19 12:37:34

  • Nixtone
  • Nixtone
  • Участник
  • Неактивен
  • Зарегистрирован: 2007-02-16
  • Сообщений: 38

Re: 1130 ошибка при соединении с сервером MySQL

Localhost сам пашет,

<?php
$i = 0;
$i++;
$cfg[‘Servers’][$i][‘host’] = ‘localhost’;
$cfg[‘Servers’][$i][‘extension’] = ‘mysql’;
$cfg[‘Servers’][$i][‘connect_type’] = ‘tcp’;
$cfg[‘Servers’][$i][‘compress’] = false;
$cfg[‘Servers’][$i][‘controluser’] = ‘pma’;
$cfg[‘Servers’][$i][‘controlpass’] = ‘пароль’;
$cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’;
$cfg[‘blowfish_secret’] = ’45d96ecb1312e4.28284630′;
?>

вот конфиг.
Делаю опять же всё по инструкции (вроде ошибок не должно было быть), и опять при авторизации он мне выдаёт:

#1130 — Host ‘localhost’ is not allowed to connect to this MySQL server

Человек способен поверить во всё что угодно, кроме правды…

6 Ответ от Lokki 2007-02-19 13:04:14

  • Lokki
  • Lokki
  • Админ
  • Неактивен
  • Откуда: Москва
  • Зарегистрирован: 2006-01-25
  • Сообщений: 910

Re: 1130 ошибка при соединении с сервером MySQL

Убери из конфига строку $cfg[‘Servers’][$i][‘host’] = ‘localhost’;

Нет неразрешимых проблем, есть неприятные решения. (Э. Борн)

7 Ответ от Nixtone 2007-02-19 13:31:10

  • Nixtone
  • Nixtone
  • Участник
  • Неактивен
  • Зарегистрирован: 2007-02-16
  • Сообщений: 38

Re: 1130 ошибка при соединении с сервером MySQL

на 2.9.2 сделал, там на старнице авторизации со страницей непонятно что стало,
на 2.8.2.4 сделал, он просто не хочет авторизовать и пишет тоже самое

Человек способен поверить во всё что угодно, кроме правды…

8 Ответ от Lokki 2007-02-19 13:34:39

  • Lokki
  • Lokki
  • Админ
  • Неактивен
  • Откуда: Москва
  • Зарегистрирован: 2006-01-25
  • Сообщений: 910

Re: 1130 ошибка при соединении с сервером MySQL

Nixtone
попробуй так:
$cfg[‘Servers’][$i][‘host’] = ‘127.0.0.1’;

Нет неразрешимых проблем, есть неприятные решения. (Э. Борн)

9 Ответ от Nixtone 2007-02-19 16:08:03

  • Nixtone
  • Nixtone
  • Участник
  • Неактивен
  • Зарегистрирован: 2007-02-16
  • Сообщений: 38

Re: 1130 ошибка при соединении с сервером MySQL

Я это раньше пробовал непомогло, попробую переустановить весь пакет, может при установке что не так сделал…

Человек способен поверить во всё что угодно, кроме правды…

10 Ответ от Nixtone 2007-02-19 16:38:03

  • Nixtone
  • Nixtone
  • Участник
  • Неактивен
  • Зарегистрирован: 2007-02-16
  • Сообщений: 38

Re: 1130 ошибка при соединении с сервером MySQL

Ещё меня интересует, почему не работают пакетные файлы, start-webserver.bat b stop-webserever.bat ??

Человек способен поверить во всё что угодно, кроме правды…

11 Ответ от Hanut 2007-02-19 18:16:01

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,723

Re: 1130 ошибка при соединении с сервером MySQL

Ещё меня интересует, почему не работают пакетные файлы, start-webserver.bat b stop-webserever.bat ??

Они могут не работать только в том случае если: сервис MySQL был переименован, или MySQL не установлен как сервис.

Воспользуйтесь предложенной вам ранее статьей, в ней по шагам все расписано.

12 Ответ от Nixtone 2007-02-21 14:30:22

  • Nixtone
  • Nixtone
  • Участник
  • Неактивен
  • Зарегистрирован: 2007-02-16
  • Сообщений: 38

Re: 1130 ошибка при соединении с сервером MySQL

В общем переустановил апач, пхп, мускл а pma всё равно ошибку скатина выдал, вот её содержание:

1.20 I receive the error «cannot load MySQL extension, please check PHP Configuration».
To connect to a MySQL server, PHP needs a set of MySQL functions called «MySQL extension». This extension may be part of the PHP distribution (compiled-in), otherwise it needs to be loaded dynamically. Its name is probably mysql.so or php_mysql.dll. phpMyAdmin tried to load the extension but failed.

Человек способен поверить во всё что угодно, кроме правды…

13 Ответ от Hanut 2007-02-21 16:56:16

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,723

Re: 1130 ошибка при соединении с сервером MySQL

Nixtone
В php.ini не подключена библиотека расширений php_mysql.dll. Читайте статью и делайте все по шагам. Не занимайтесь самодеятельностью, на обум ничего работать не будет.

14 Ответ от Nixtone 2007-02-21 20:14:23

  • Nixtone
  • Nixtone
  • Участник
  • Неактивен
  • Зарегистрирован: 2007-02-16
  • Сообщений: 38

Re: 1130 ошибка при соединении с сервером MySQL

Так в том то и дело что данная библиотека подключена, я сам проверял, и устанавливал пхп точно по инструкции с этого сайта

Человек способен поверить во всё что угодно, кроме правды…

15 Ответ от Lokki 2007-02-21 21:17:46

  • Lokki
  • Lokki
  • Админ
  • Неактивен
  • Откуда: Москва
  • Зарегистрирован: 2006-01-25
  • Сообщений: 910

Re: 1130 ошибка при соединении с сервером MySQL

Так в том то и дело что данная библиотека подключена, я сам проверял

Вот об этом подробней, пожалуйста. Каким образом ты убедился в том, что библиотека подключена?

Нет неразрешимых проблем, есть неприятные решения. (Э. Борн)

16 Ответ от Nixtone 2007-02-22 00:59:29

  • Nixtone
  • Nixtone
  • Участник
  • Неактивен
  • Зарегистрирован: 2007-02-16
  • Сообщений: 38

Re: 1130 ошибка при соединении с сервером MySQL

Уточнил в инструкции как библилотека называется, посмотрел в php.ini — коментарий убран, extansion_dir прописан правильно, сама библиотека на месте(Чё делать? Сам не знаю, хоть убей). В ошибке той что я написал пишется что пхп не поддерживает мускл расширения какого-то, что скажете по поводу?

Человек способен поверить во всё что угодно, кроме правды…

17 Ответ от Lokki 2007-02-22 10:20:35

  • Lokki
  • Lokki
  • Админ
  • Неактивен
  • Откуда: Москва
  • Зарегистрирован: 2006-01-25
  • Сообщений: 910

Re: 1130 ошибка при соединении с сервером MySQL

Nixtone

Уточнил в инструкции как библилотека называется, посмотрел в php.ini — коментарий убран, extansion_dir прописан правильно, сама библиотека на месте

Это еще не 100% гарантия того, что библиотека подключена. Если у тебя неправильно прописан PATH, то PHP не сможет найти библиотеки, даже при корректном extansion_dir.

Убедиться можно, посмотрев информацию о PHP с помощью функции phpinfo():
раздел ‘mysql’ -> Client API version

В ошибке той что я написал пишется что пхп не поддерживает мускл расширения какого-то, что скажете по поводу?

Как уже было написано выше — нужно подключить библиотеку php_mysql.dll

Нет неразрешимых проблем, есть неприятные решения. (Э. Борн)

18 Ответ от Nixtone 2007-02-22 14:12:24

  • Nixtone
  • Nixtone
  • Участник
  • Неактивен
  • Зарегистрирован: 2007-02-16
  • Сообщений: 38

Re: 1130 ошибка при соединении с сервером MySQL

Убедиться можно, посмотрев информацию о PHP с помощью функции phpinfo():
раздел ‘mysql’ -> Client API version

Какой раздел и где его найти???

Человек способен поверить во всё что угодно, кроме правды…

19 Ответ от Hanut 2007-02-22 20:18:02

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,723

Re: 1130 ошибка при соединении с сервером MySQL

Nixtone
Необходимо создать скрипт следующего содержания:

Запустить его и найти раздел MySQL. Если данного раздела нет, значит расширение MySQL не подгружено.

20 Ответ от Nixtone 2007-02-22 20:28:20

  • Nixtone
  • Nixtone
  • Участник
  • Неактивен
  • Зарегистрирован: 2007-02-16
  • Сообщений: 38

Re: 1130 ошибка при соединении с сервером MySQL

Сделал, раздела MySQL ненашол, что делать?

Человек способен поверить во всё что угодно, кроме правды…

21 Ответ от Hanut 2007-02-23 18:30:53

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,723

Re: 1130 ошибка при соединении с сервером MySQL

Nixtone
MySQL должен быть установлен как сервис и запущен.

22 Ответ от Nixtone 2007-02-23 19:21:53

  • Nixtone
  • Nixtone
  • Участник
  • Неактивен
  • Зарегистрирован: 2007-02-16
  • Сообщений: 38

Re: 1130 ошибка при соединении с сервером MySQL

установлен как сервис и запущен он у меня, а всё равно pma чёта нехватает

Человек способен поверить во всё что угодно, кроме правды…

23 Ответ от Hanut 2007-02-23 19:57:55

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,723

Re: 1130 ошибка при соединении с сервером MySQL

Pma здесь не при чем. Поищите дубли php.ini. Возможно инициализируется не тот конфигурационный файл.

24 Ответ от Nixtone 2007-03-14 14:08:28

  • Nixtone
  • Nixtone
  • Участник
  • Неактивен
  • Зарегистрирован: 2007-02-16
  • Сообщений: 38

Re: 1130 ошибка при соединении с сервером MySQL

ПАЗДРАВЬТЕ МЕНЯ Я УСТАНОВИЛ PHPMYADMIN!!!!!!!!!!!!!!!!!!!!!!!!!!

Человек способен поверить во всё что угодно, кроме правды…

25 Ответ от Mig Dandy 2007-07-25 10:50:33

  • Mig Dandy
  • Редкий гость
  • Неактивен
  • Зарегистрирован: 2007-07-25
  • Сообщений: 4

Re: 1130 ошибка при соединении с сервером MySQL

Nixtone сказал:

ПАЗДРАВЬТЕ МЕНЯ Я УСТАНОВИЛ PHPMYADMIN!!!!!!!!!!!!!!!!!!!!!!!!!!

Расскажи всем…В чем была проблемма…Сейчас сам с этим мучаюсь!!!

Страницы 1 2 Далее

Чтобы отправить ответ, вы должны войти или зарегистрироваться

If you are trying to access your database server remotely and getting below error during MySQL login:

Error:

“ERROR 1130 (HY000): Host ‘10.120.152.137’ is not allowed to connect to this MySQL server”

Then this article will help you to resolve this issue. In this article I will show you how to fix this error.

Mostly this error comes when your root user only have been added with localhost access. You can check using below command, first of all go to your mysql database server and type the below command to check:

mysql> SELECT host FROM mysql.user WHERE User = 'root';
+-----------+
| host      |
+-----------+
| 127.0.0.1 |
| ::1       |
| localhost |
+-----------+
3 rows in set (0.00 sec)

As you can see that root is only allowed from localhost 127.0.0.1. you cannot connect from an external source. If you see other IP addresses.

Next You will need to add the IP address of each system that you want to grant access to, and then grant privileges like below:

CREATE USER 'root'@'ip_address' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'ip_address';

You can also allow your root to connect from any remote source use the below command:

CREATE USER 'root'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';

Finally, reload the permissions, and you should be able to have remote access:

FLUSH PRIVILEGES;

If still you are getting same error check open your my.cnf file and check for below line:

bind-address  = 127.0.0.1

Now Comment out the bind address from the file /etc/mysql/my.cnf.

#bind-address  = 127.0.0.1

Next restart mysqld service to apply above changes.

# /etc/init.d/mysqld restart

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive.
For more helpful topic browse my website www.looklinux.com.
To become an author at LookLinux Submit Article.
Stay connected to Facebook.

You may also like

About the author

mm

Hi! I’m Santosh and I’m here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Понравилась статья? Поделить с друзьями:
  • Mysql error number 1114
  • Mysql error number 1062
  • Mysql error no 1067
  • Mysql error max user connections
  • Mysql error log xampp