Set execute permission to the downloaded file using “ chmod” command. Paste the download link in terminal using the “ wget” command. We hope one of the above possible solutions to the can’t connect to local mysql server through socket error resolves your situation.Download Ampps setup file from official web site and copy the Ampps setup download link, Next, kill the mysql process by running this command:įinally, go ahead run the following commands to restart and connect to the MySQL server:Ĭonclusion on Can’t Connect to Local MySQL Server Through Socket So you have a case whereby multiple instances of MySQL are running at the same time.Īs such the issue running the following commands can fix the issue: In some cases, the installation of multiple MySQL on the server environment causes this problem. Then try to establish the connection again. There one other possible solution fixing this issue and that is to change the MySQL folder’s permission.Īnd this can be done easily by running the following command if you’re working on a local environment:Īfter which you can restart mysql service: Super Fast Servers with 24/7/365 Technical Support!Ĭlick here to access this Solution #5: Change MySQL Folder Permission.Multi-Domain Hosting & 99.9% Uptime Guarantee!.Support for PHP, MySQL, WordPress, Drupal, Joomla and much more!.FREE 1-Click Install of Open Source Apps, Blog, CMS, and much more!.Once you do this, go ahead and restart the MySQL service and try initiating the connection again. Ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock So for instance, if you locate the file in /data/mysql_datadir/mysql.sock, all you need to do is create a symlink for it using the following command: Most times the file is located in either the /data/mysql_datadir/mysql.sock or /tmp/mysql.sock So you need to locate where the mysql.sock file and create a symlink to it. Solution #4: Verify mysql.sock LocationĪnother possible cause of this problem is that the mysql.sock file in another directory. So locate this my.cnf file which is normally in the /etc/ directory and modify it accordingly as follows:Īfter modifying the file restart your MySQL service and try connecting again. And it’s processed by either the mysqld or mysqladmin service depending on the options specified. The my.cnf file is a configuration file used by MySQL. So as a possible solution when you’re having issues with the socket connector, you can try to establish the connection using TCP/IP by specifying the 127.0.0.1 ip address instead of localhost. However, if you use 127.0.0.1 ip address, the operating system will use the TCP/IP connector. When you use localhost to connect to MySQL, the operating system uses the socket connector. Solution #2: Connect with 127.0.0.1Īnother possible solution to the >can’t connect to local mysql server through socket> error message is to try and connect to the MySQL using the 127.0.0.1 ip address instead of localhost. Once you restart the service, try again to connect to MySQL. SQLSTATE Can't connect to local MySQL server through socket Then you have those we experience this same problem with their website application especially those built with PHP.įor example, all of a sudden the website refuses to work, and when you pry into the log file you see the error message logged there similar to this one: On the other hand, for others, this error message arises when they try to log into the MySQL database using any user credentials. This error message is basically telling you that the application is not able to locate the socket file needed to establish a MySQL connection.Īnd as you well know the socket file is used by the operating system to enable interface services such as MySQL or PHP to interact and communicate among each other.įor some people this appear message may occur when trying to restart MySQL and run the:Ĭan't connect to local MySQL server through socket '/var/mysql/mysql.sock' (38) So what’s causing the can’t connect to local mysql server through socket error message? What Is Can’t Connect to Local MySQL Server Through Socket Error? Conclusion on Can’t Connect to Local MySQL Server Through Socket.Solution #5: Change MySQL Folder Permission.Solution #4: Verify mysql.sock Location.Solution #1: Check If MySQL Service is Runnning.
0 Comments
Leave a Reply. |