Solve MySQL Can’t Connect To Local MySQL Server Through Socket

Solve MySQL Can’t connect, MySQL is an open-source relational database management system(RDMS) based on SQL query. It’s the most widely used relational database nowadays. It runs on Port 3306. When you face MySQL connection issue like can’t connect to localhost through the socket.

Solve MySQL Can’t connect to local MySQL server through socket:

Why do we need it?

MySQL is used to store the data of any applications, website, software, etc with the help of the database. We’re able to access any applications, website data, and more And It plays a very important role.

Check Out: Create User, Database, Tables in Mysql Server

MySQL Features:

  • Easy to use
  • It is secure
  • High Flexibility
  • Client/ Server Architecture
  • It is scalable
  • High Performance
  • High Productivity

Let’s solve our issue which we’re facing in MySQL server

First, check what version is installed on the server and run the command to check whether the package is installed or not.

rpm –qa mysql*

mysql issue socket

Now try to login MySQL server by command line

mysql -u root –p

Check Out: How To Check Users In Mysql Database Server In Linux

Put the MySQL password.

If you face this issue that’s mean you have not started the MySQL service yet. To start the MySQL service first.

Command For Redhat/CentOS 7

systemctl start mysqld

To check status

systemctl status mysqld

Enable on boot time

systemctl enable mysqld

Command For Redhat/CentOS 7

service mysqld start/status/enable

Now See MySQL Service started and initializing database connection also.

Check Out: How To Enable Slow Query In MySQL Server In Linux

mysql connection issue

Now you will be able to login MySQL server.

That was an issue only as you did not start the service.

That’s it. mysql issue socket mysql can’t connect to localhost connection

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment