{"id":3883,"date":"2014-12-06T01:01:48","date_gmt":"2014-12-06T07:01:48","guid":{"rendered":"http:\/\/icesquare.com\/wordpress\/?p=3883"},"modified":"2014-12-06T17:57:36","modified_gmt":"2014-12-06T23:57:36","slug":"mysql-random-error-error-2013-hy000-lost-connection-to-mysql-server-at-reading-authorization-packet-system-error-0","status":"publish","type":"post","link":"https:\/\/icesquare.com\/wordpress\/mysql-random-error-error-2013-hy000-lost-connection-to-mysql-server-at-reading-authorization-packet-system-error-0\/","title":{"rendered":"MySQL Random Error: ERROR 2013 (HY000): Lost connection to MySQL server at &#8216;reading authorization packet&#8217;, system error: 0"},"content":{"rendered":"<p>Recently, I am experiencing a weird error when connecting to a MySQL server <strong>remotely<\/strong>: <\/p>\n<pre>\r\nERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0\r\n<\/pre>\n<p>Basically, this error is similar to the busy tone when you are making calls. The key thing is, it happens randomly. Sometimes the connection is okay, sometimes it takes any where from 0.01 to 30 seconds to establish a connection. Sometimes it gets time-out.\n<\/p>\n<p>Long story short. Continue to read this article if you have met the following conditions:<\/p>\n<ul>\n<li>You try to connect to a MySQL server remotely, i.e., not localhost(127.0.0.1)<\/li>\n<li>It happens randomly. It can take anywhere from 0.01 seconds to 30 seconds to establish a connection. Sometimes it fails.<\/li>\n<li>You connect the server using IP address, i.e., it has nothing to do with the domain name, or <strong>skip-name-resolve<\/strong> in my.cnf<\/li>\n<li>You have included the client IP address in \/etc\/hosts.allow.<\/li>\n<\/ul>\n<p>The key thing is: <strong>Random<\/strong>.<\/p>\n<p>You probably have scratched your head for few hours (or days), gone through tons of useless suggestions on Google\/Stackoverflow\/Serverfault etc, and the problem still exists. Oh well, at least this has been happened on me in the past 24 hours.<\/p>\n<p>Before we discussed the problem, let&#8217;s try to reproduce the problem:<\/p>\n<pre>\r\n#In the client computer, we try to connect to \r\n#the MySQL database remotely and run a simply command:\r\ntime mysql -u root -pPASSWORD -h IP_ADDRESS -e \"show databases;\"\r\n\r\n#Case 1: Everything is okay\r\nreal    0m0.001s\r\nuser    0m0.001s\r\nsys     0m0.001s\r\n\r\n\r\n#Case 2: it takes 20 seconds to establish a connection. \r\n#That's not right.\r\nreal    0m20.001s\r\nuser    0m0.003s\r\nsys     0m0.003s\r\n\r\n#Case 3: Cannot even make the connection.\r\nERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0\r\nreal    0m49.617s\r\nuser    0m0.003s\r\nsys     0m0.003s\r\n<\/pre>\n<p>If you also observe a similar symptoms, I can tell you that the problem may not be related to MySQL server or MySQL settings. I recommend you to check your network traffic. Here are my suggestions:<\/p>\n<pre>\r\n#Check which process is running.\r\ntop\r\n\r\n#Or you can check which process is running by the web server user\r\n#In my case, apache is the web server user\r\nps -u apache\r\n\r\n#Or you can check the current traffic using nload\r\nnload -u M\r\n<\/pre>\n<p>If you are lucky, you may notice that there is a huge network traffic going on. The traffic is the main problem that cause the problem. Try to kill that process or perform a reboot.<\/p>\n<p>Let&#8217;s take my case an example. I noticed a weird process running by the apache user:<\/p>\n<pre>\r\nps -u apache\r\n\r\n  PID TTY          TIME CMD\r\n 8112 ?        00:00:09 httpd\r\n 8113 ?        00:00:08 httpd\r\n 8334 ?        00:00:08 httpd\r\n 8796 ?        00:00:06 httpd\r\n 8802 ?        00:00:07 httpd\r\n 8891 ?        00:00:07 something (This is a malware)\r\n<\/pre>\n<p>After I kill that process, everything is back to normal again.<\/p>\n<p>&#8211;Derrick<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I am experiencing a weird error when connecting to a MySQL server remotely: ERROR 2013 (HY000): Lost connection to MySQL server at &#8216;reading authorization packet&#8217;, system error: 0 Basically, <a class=\"more-link\" href=\"https:\/\/icesquare.com\/wordpress\/mysql-random-error-error-2013-hy000-lost-connection-to-mysql-server-at-reading-authorization-packet-system-error-0\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[146,144,6],"tags":[9],"class_list":["post-3883","post","type-post","status-publish","format-standard","hentry","category-everyday-computer-problem","category-sever-problem","category-technology","tag-mysql"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p1sqzr-10D","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1028,"url":"https:\/\/icesquare.com\/wordpress\/mysql-starting-mysql-error-the-server-quit-without-updating-pid-file\/","url_meta":{"origin":3883,"position":0},"title":"MySQL: Starting MySQL&#8230;.. ERROR! The server quit without updating PID file","author":"Derrick","date":"November 12, 2010","format":false,"excerpt":"This step-by-step guide is mainly for FreeBSD, however the idea is the same for Linux. Every once a while, when I update my FreeBSD box, the system likes to shutdown my MySQL server. Therefore, I need to start it again after the update is done. Unfortunately, the upgrade process is\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":626,"url":"https:\/\/icesquare.com\/wordpress\/error-2006-hy000-at-line-172-mysql-server-has-gone-away\/","url_meta":{"origin":3883,"position":1},"title":"ERROR 2006 (HY000) at line 172: MySQL server has gone away","author":"Derrick","date":"April 13, 2010","format":false,"excerpt":"Today I imported the MySQL database and I got the following error: # mysql -u root -p db_test < test.db Enter password: ERROR 2006 (HY000) at line XX: MySQL server has gone away It is because the data (SQL query) is too large to imported. To solve this problem, simply\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":613,"url":"https:\/\/icesquare.com\/wordpress\/starting-mysql-error-the-server-quit-without-updating-pid-file\/","url_meta":{"origin":3883,"position":2},"title":"Starting MySQL.. ERROR! The server quit without updating PID file","author":"Derrick","date":"April 13, 2010","format":false,"excerpt":"This article is a bit outdated. Please visit the following article instead. It includes a better discussion on how to solve this problem using different scenarios: MySQL: Starting MySQL\u2026.. ERROR! The server quit without updating PID file Thanks. --Derrick [ad#ad-bottom]","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2156,"url":"https:\/\/icesquare.com\/wordpress\/cant-connect-to-local-mysql-server-through-socket-varlibmysqlmysql-sock-2\/","url_meta":{"origin":3883,"position":3},"title":"Can&#8217;t connect to local MySQL server through socket &#8216;\/var\/lib\/mysql\/mysql.sock&#8217; (2)","author":"Derrick","date":"December 21, 2011","format":false,"excerpt":"When I tried to connect to the MySQL server through PHP, I got the following error: Can't connect to local MySQL server through socket '\/var\/lib\/mysql\/mysql.sock' (2) To give you some background, here is my situation. My Fedora Linux is a 64-bit machine, and I have installed a 32-bit version of\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4083,"url":"https:\/\/icesquare.com\/wordpress\/rhel-7-mariadb-mysql-error-1018-hy000-cant-read-dir-of-errno-24\/","url_meta":{"origin":3883,"position":4},"title":"RHEL 7 \/ MariaDB \/ MySQL: ERROR 1018 (HY000): Can&#8217;t read dir of &#8216;.&#8217; (errno: 24)","author":"Derrick","date":"March 5, 2016","format":false,"excerpt":"Recently, I decided to upgrade a database server from RHEL 6 (CentOS 6) to RHEL 7 (CentOS 7), which involves switching from MySQL 5.5 to MariaDB 5.5. Our server hosts about 100 databases, when I was testing them individually, I didn't see any problem. However, when I ran the back\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3023,"url":"https:\/\/icesquare.com\/wordpress\/freebsdmysql-server-could-not-start\/","url_meta":{"origin":3883,"position":5},"title":"[FreeBSD]MySQL server could not start","author":"Derrick","date":"November 22, 2012","format":false,"excerpt":"Today, I noticed that the MySQL server on my FreeBSD server is down for unknown reason, and today is Thanksgiving. Initially, I tried to restart the MySQL server using the following command, but it didn't help to restart the MySQL: sudo \/usr\/local\/etc\/rc.d\/mysql-server restart and it gives me the following error\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/3883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/comments?post=3883"}],"version-history":[{"count":16,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/3883\/revisions"}],"predecessor-version":[{"id":3899,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/3883\/revisions\/3899"}],"wp:attachment":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/media?parent=3883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/categories?post=3883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/tags?post=3883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}