You might have came across this error when you tried development of Ruby on Rails project with MySQL as your development database.
This file is required for your application to get connected to your MySQL database.
Basically Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) this error can come when your MySQL server is not started.
You can start you MySQL server by using following command:
Command to start MySQL Server
This will start your MySQL server and it will create the file‘/tmp/mysql.sock’ which is required for your application to get connected to the MySQL server.
The output after you hit enter by above command is:
**which indicates successful start of your MySQL server.
This will solve the error Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2). Then you just have to restart your application.
Command to Stop MySQL Server:
The result of above operation:
You can read more commands regarding MySQL server in this post.
Comments are welcome.