{"id":11474,"date":"2024-02-29T17:13:50","date_gmt":"2024-02-29T11:43:50","guid":{"rendered":"https:\/\/www.skynats.com\/?p=11474"},"modified":"2025-01-08T20:36:57","modified_gmt":"2025-01-08T15:06:57","slug":"how-to-solve-mysql-error-1130","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/how-to-solve-mysql-error-1130\/","title":{"rendered":"How to solve: ERROR 1130 (HY000): Host &#8217;90.xxx.xxx.101&#8242; is not allowed to connect to this MySQL server"},"content":{"rendered":"\n<figure class=\"wp-block-image size-medium\"><img fetchpriority=\"high\" decoding=\"async\" width=\"300\" height=\"169\" sizes=\"(max-width: 300px) 100vw, 300px\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/mysql-error-300x169.jpg\" alt=\"My SQL error:1130\" class=\"wp-image-11476\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/mysql-error-300x169.jpg 300w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/mysql-error-1024x576.jpg 1024w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/mysql-error-768x432.jpg 768w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/mysql-error-1200x675.jpg 1200w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/mysql-error.jpg 1280w\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Scenario :<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Getting error 1130 when trying to remotely connect <a href=\"https:\/\/www.mysql.com\/\" target=\"_blank\" rel=\"noopener\">MySQL <\/a>server with  ip address 172.xxx.201.xxx from my server 90.xxx.xxx.101 using the Database user \u2018test_123\u2019.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To resolve the above error, first log into the <a href=\"https:\/\/www.skynats.com\/server-management\/\">MySQL <\/a>server in 172.xxx.201.xxx and search for the user test_123, to ensure whether it exists on the server.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#mysql -u root -p\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql&gt;<strong>SELECT user,host FROM mysql.user WHERE user = 'test_123';<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The above query is used for checking whether the user exists or not and if so, from which host or IP address they have permission to access.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>+----------------+--------------+\n| user           | host         |\n+----------------+--------------+\n| test_123       | localhost    |\n+----------------+--------------+\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">So the user can only access the system via localhost. This is why it was unable to login to the server 90.xxx.xxx.101 with this user.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now we can easily solve error by creating the user with permission to access  MySQL server (172.xxx.201.xxx) from my server (90.xxx.xxx.101)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To do so, create the same user again with the host as 90.xxx.xxx.101:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql&gt; CREATE USER 'test_123'@'90.xxx.xxx.101' IDENTIFIED BY 'password';\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then, grant privileges to the user using the GRANT PRIVILEGES query.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here we will be&nbsp; granting all privileges on the database \u201ctest_db1\u201d to the user:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql&gt; GRANT ALL PRIVILEGES ON test_db1.* TO 'test_123'@'90.xxx.xxx.101'; \nmysql&gt; FLUSH PRIVILEGES;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For testing,&nbsp; use the SELECT user,host FROM mysql.user WHERE user = &#8216;test_123&#8217;; query again, Now we could see:&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n+----------------+---------------------+\n| user           | host                |\n+----------------+---------------------+\n| test_123       | localhost \t      |\n| test_123       | 90.xxx.xxx.101      |\n+----------------+---------------------+\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now its showing that the user can access the <a href=\"https:\/\/www.skynats.com\/server-management\/\">MySQL server<\/a> both via localhost and 90.xxx.xxx.101.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can&nbsp; now able to connect to the <a href=\"https:\/\/www.skynats.com\/server-management\/\">MySQL server<\/a> remotely from 90.xxx.xxx.101 using the Database user \u2018test_123\u2019.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$mysql -h 90.xxx.xxx.101 -u test_123 -p<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Enter password:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Welcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is XXXX\nServer version: 5.7.32 MySQL Community Server (GPL)\n\n\nCopyright (c) 2000, 2023, Oracle and\/or its affiliates.\n\nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n\nmysql&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s how we could fix the ERROR 1130 (HY000): Host &#8217;90.xxx.xxx.101&#8242; which is not allowed to connect to the <a href=\"https:\/\/www.skynats.com\/server-management\/\">MySQL server, <\/a>when trying to access mysql remotely. You could also create the user with the host as \u2018%\u2019, but be aware, this will grant access to the user from &#8220;any remote source&#8221;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our&nbsp;<a href=\"https:\/\/www.skynats.com\/blog\/\">Support Team<\/a>&nbsp;is available to help if you encounter any issues or errors.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scenario : Getting error 1130 when trying to remotely connect MySQL server with ip address 172.xxx.201.xxx from my server 90.xxx.xxx.101 using the Database user \u2018test_123\u2019.&nbsp; To resolve the above error, first log into the MySQL server in 172.xxx.201.xxx and search for the user test_123, to ensure whether it exists on the server. The above query [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[257,5,300,250,68],"tags":[299,701,46],"class_list":["post-11474","post","type-post","status-publish","format-standard","hentry","category-mysql","category-blog","category-database","category-mssql-server","category-server-management","tag-database","tag-mysql","tag-mysql-server"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/11474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=11474"}],"version-history":[{"count":0,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/11474\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=11474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=11474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=11474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}