{"id":1698,"date":"2021-03-18T18:34:45","date_gmt":"2021-03-18T22:34:45","guid":{"rendered":"https:\/\/cyburityllc.com\/?p=1698"},"modified":"2022-02-22T16:04:29","modified_gmt":"2022-02-22T21:04:29","slug":"how-to-fix-error-error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysqld-s","status":"publish","type":"post","link":"https:\/\/dialer.one\/index.php\/how-to-fix-error-error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysqld-s\/","title":{"rendered":"How to &#8211; Fix error: ERROR 2002 (HY000): Can&#8217;t connect to local MySQL server through socket &#8216;\/var\/run\/mysqld\/mysqld.s"},"content":{"rendered":"\n<p>MySQL manages connections to the database server through the use of a&nbsp;<em>socket file<\/em>, a special kind of file that facilitates communications between different processes. The MySQL server\u2019s socket file is named&nbsp;<code>mysqld.sock<\/code>&nbsp;and on Ubuntu systems it\u2019s usually stored in the&nbsp;<code>\/var\/run\/mysqld\/<\/code>&nbsp;directory. This file is created by the MySQL service automatically.<\/p>\n\n\n\n<p>Sometimes, changes to your system or your MySQL configuration can result in MySQL being unable to read the socket file, preventing you from gaining access to your databases. The most common socket error looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>OutputERROR 2002 (HY000): Can't connect to local MySQL server through socket '\/var\/run\/mysqld\/mysqld.sock' (2)\n<\/code><\/pre>\n\n\n\n<p>There are a few reasons why this error may occur, and a few potential ways to resolve it.<\/p>\n\n\n\n<p>One common cause of this error is that the MySQL service is stopped or did not start to begin with, meaning that it was unable to create the socket file in the first place. To find out if this is the reason you\u2019re seeing this error, try starting the service with&nbsp;<code>systemctl<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start mysql\n<\/code><\/pre>\n\n\n\n<p>Then try accessing the MySQL prompt again. If you still receive the socket error, double check the location where your MySQL installation is looking for the socket file. This information can be found in the&nbsp;<code>mysqld.cnf<\/code>&nbsp;file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/mysql\/mysql.conf.d\/mysql.cnf\n<\/code><\/pre>\n\n\n\n<p>Look for the&nbsp;<code>socket<\/code>&nbsp;parameter in the&nbsp;<code>[mysqld]<\/code>&nbsp;section of this file. It will look like this:\/etc\/mysql\/mysql.conf.d\/mysqld.cnf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>. . .\n&#91;mysqld]\nuser            = mysql\npid-file        = \/var\/run\/mysqld\/mysqld.pid\nsocket          = \/var\/run\/mysqld\/mysqld.sock\nport            = 3306\n. . .<\/code><\/pre>\n\n\n\n<p>Close this file, then ensure that the&nbsp;<code>mysqld.sock<\/code>&nbsp;file exists by running an&nbsp;<code>ls<\/code>&nbsp;command on the directory where MySQL expects to find it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ls -a \/var\/run\/mysqld\/\n<\/code><\/pre>\n\n\n\n<p>\u00a0If the socket file exists, you will see it in this command\u2019s output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Output.  ..  mysqld.pid  mysqld.sock  mysqld.sock.lock\n<\/code><\/pre>\n\n\n\n<p>If the file does not exist, the reason may be that MySQL is trying to create it, but does not have adequate permissions to do so. You can ensure that the correct permissions are in place by changing the directory\u2019s ownership to the&nbsp;<strong>mysql<\/strong>&nbsp;user and group:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chown mysql:mysql \/var\/run\/mysqld\/\n<\/code><\/pre>\n\n\n\n<p>\u00a0Then ensure that the\u00a0<strong>mysql<\/strong>\u00a0user has the appropriate permissions over the directory. Setting these to\u00a0<code>775<\/code>\u00a0will work in most cases:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chmod -R 755 \/var\/run\/mysqld\/\n<\/code><\/pre>\n\n\n\n<p>\u00a0Finally, restart the MySQL service so it can attempt to create the socket file again:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart mysql\n<\/code><\/pre>\n\n\n\n<p>\u00a0Then try accessing the MySQL prompt once again. If you still encounter the socket error, there\u2019s likely a deeper issue with your MySQL instance, in which case you should review the error log to see if it can provide any clues.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL manages connections to the database server through the use of a&nbsp;socket file, a special kind of file that facilitates communications between different processes. The MySQL server\u2019s socket file is named&nbsp;mysqld.sock&nbsp;and on Ubuntu systems it\u2019s usually stored in the&nbsp;\/var\/run\/mysqld\/&nbsp;directory. This file is created by the MySQL service automatically. Sometimes, changes to your system or your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":866,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"content-type":"","_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}},"categories":[],"tags":[],"class_list":["post-1698","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/dialer.one\/wp-content\/uploads\/2020\/08\/touch_lock.png","jetpack-related-posts":[{"id":3152,"url":"https:\/\/dialer.one\/index.php\/how-to-optimize-your-database-using-the-mysql-tuning-tool\/","url_meta":{"origin":1698,"position":0},"title":"How to &#8211; Optimize your database using the MySQL tuning tool","author":"carpenox","date":"August 3, 2023","format":false,"excerpt":"How to - Optimize your database using the MySQL tuning tool This article will go over how to optimize your database using the mysql-tuning tool included in your extras directory. The great thing about this tool is you can keep using it. You can use it after your initial install\u2026","rel":"","context":"In &quot;Vicidial&quot;","block_context":{"text":"Vicidial","link":"https:\/\/dialer.one\/index.php\/category\/vicidial\/"},"img":{"alt_text":"MySQL tuning","src":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2023\/08\/Screenshot_20230803-2056432.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2023\/08\/Screenshot_20230803-2056432.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2023\/08\/Screenshot_20230803-2056432.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2023\/08\/Screenshot_20230803-2056432.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2023\/08\/Screenshot_20230803-2056432.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":2256,"url":"https:\/\/dialer.one\/index.php\/how-to-scratch-install-vicidial-on-rockylinux-8-5\/","url_meta":{"origin":1698,"position":1},"title":"How to \u2013 Scratch install Vicidial on RockyLinux 8.5","author":"carpenox","date":"December 30, 2021","format":false,"excerpt":"How to \u2013 Scratch install Vicidial on RockyLinux 8.5 RockyLinux 8.5 This article goes over how to install vicidial on RockyLinux 8 sed -i 's\/SELINUX=enforcing\/SELINUX=disabled\/g' \/etc\/selinux\/config Set Default Editor to nano: yum -y install nano nano \/etc\/bashrc Then add this line at the bottom: export EDITOR=\"nano\" timedatectl set-timezone America\/New_York rc.local\u2026","rel":"","context":"In &quot;Vicidial&quot;","block_context":{"text":"Vicidial","link":"https:\/\/dialer.one\/index.php\/category\/vicidial\/"},"img":{"alt_text":"RockyLinux","src":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/12\/image.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2104,"url":"https:\/\/dialer.one\/index.php\/how-to-scratch-install-vicidial-on-centos-8\/","url_meta":{"origin":1698,"position":2},"title":"How to &#8211; Scratch install Vicidial on CentOS 8","author":"carpenox","date":"June 13, 2021","format":false,"excerpt":"How to - Scratch install Vicidial on CentOS 8 This article will go over how to do a scratch install for Vicidial on CentOS 8. The majority of this was mapped out by Steve @ GenXoutsourcing. Thanks Steve UPDATE: 6\/13\/21 -:- Special thanks to arx001 from the Vicidial Group Forums\u2026","rel":"","context":"With 1 comment","block_context":{"text":"With 1 comment","link":"https:\/\/dialer.one\/index.php\/how-to-scratch-install-vicidial-on-centos-8\/#comments"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/img.youtube.com\/vi\/TyXEMhb9Nso\/0.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2235,"url":"https:\/\/dialer.one\/index.php\/how-to-scratch-install-vicidial-on-almalinux\/","url_meta":{"origin":1698,"position":3},"title":"How to \u2013 Scratch install Vicidial on AlmaLinux","author":"carpenox","date":"November 16, 2021","format":false,"excerpt":"How to \u2013 Scratch install Vicidial on AlmaLinux This article will go over how to scratch install Vicidial on AlmaLinux 8.6 -:- Special thanks to https:\/\/zestvoip.com\/ and https:\/\/zenithbsolutions.com\/ for testing this out. You can also use the Video tutorial at the bottom created by HBtutorials IMPORTANT UPDATE: Alma changed one\u2026","rel":"","context":"In &quot;Vicidial&quot;","block_context":{"text":"Vicidial","link":"https:\/\/dialer.one\/index.php\/category\/vicidial\/"},"img":{"alt_text":"CyburDial Realtime Screen","src":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/07\/realtime2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/07\/realtime2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/07\/realtime2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/07\/realtime2.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/07\/realtime2.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":2470,"url":"https:\/\/dialer.one\/index.php\/how-to-setup-a-slave-db-for-a-scratch-installed-vicidial\/","url_meta":{"origin":1698,"position":4},"title":"How to &#8211; Setup a slave DB for a scratch installed ViciDial","author":"carpenox","date":"April 24, 2022","format":false,"excerpt":"How to - Setup a slave DB for a scratch installed ViciDial This Article will go over how to setup a slave database server for your ViciDial cluster when using a scratch installed server bunch. For this particular example I have used Alma Linux 9.5 which installs Mysql 10.3.28, if\u2026","rel":"","context":"In &quot;Vicidial&quot;","block_context":{"text":"Vicidial","link":"https:\/\/dialer.one\/index.php\/category\/vicidial\/"},"img":{"alt_text":"Slave DB","src":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2022\/04\/image-11.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2022\/04\/image-11.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2022\/04\/image-11.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2022\/04\/image-11.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1588,"url":"https:\/\/dialer.one\/index.php\/how-to-scratch-instructions-for-vicidialvicibox9-on-opensuse-leap-15-2\/","url_meta":{"origin":1698,"position":5},"title":"How to &#8211; Scratch instructions for  Vicidial(Vicibox9) on OpenSuSE Leap 15.2","author":"carpenox","date":"March 11, 2021","format":false,"excerpt":"How to - Scratch instructions for Vicidial(Vicibox9) on OpenSuSE Leap 15.2 So, I have installed Vicidial on Leap 15.2 and wrote up an instructions step by step and wanted to share it for others to try and make sure it works for you as well. I have tested this on\u2026","rel":"","context":"With 6 comments","block_context":{"text":"With 6 comments","link":"https:\/\/dialer.one\/index.php\/how-to-scratch-instructions-for-vicidialvicibox9-on-opensuse-leap-15-2\/#comments"},"img":{"alt_text":"Leap15.2","src":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/03\/Leap15.2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/03\/Leap15.2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/03\/Leap15.2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/03\/Leap15.2.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/03\/Leap15.2.png?resize=1050%2C600&ssl=1 3x"},"classes":[]}],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/posts\/1698","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/comments?post=1698"}],"version-history":[{"count":0,"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/posts\/1698\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/media\/866"}],"wp:attachment":[{"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/media?parent=1698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/categories?post=1698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/tags?post=1698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}