How to Troubleshoot and Up mysql ?
Kill mysql running processes by greping its pid from by one of the folloeing commands:
ps -aux | grep mysql ps -A | grep mysql pkill -9 mysql
Service mysql status ( it reflects status with process id, if mysql service is running)
It may shows more than one process running states cause of confliction , mysql will not restart till it has more than one pid.
mysqladmin -u username -p status
If server is not running then it will dump error as follows:
mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
If MySQL server is running it will display output as
Uptime: 4 Threads: 1 Questions: 62 Slow queries: 0 Opens: 51 Flush tables: 1 Open tables: 45 Queries per second avg: 15.500
It displays uptime and number of queries etc.
- mysql -h 127.0.0.1 -p 3306 -u username -p
Is also to check whether mysql is running on localhost or not.