Getting MySql error

June 20, 2019 237 views
MySQL

Here is the complete error that I'm getting:

Warning: mysqlirealconnect(): (HY000/2002): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) in /var/www/thehotskills.com/public_html/wp-includes/wp-db.php on line 1603

Deprecated: mysqlconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/www/thehotskills.com/publichtml/wp-includes/wp-db.php on line 1633

Warning: mysqlconnect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) in /var/www/thehotskills.com/publichtml/wp-includes/wp-db.php on line 1633

My site auto stopped working after some time and get the above errors. To solve this problem, I need to restart again-n-again MySql servers.

How I can solve this problem so that I do not need to start servers again-n-again.

Thanks in advance!

2 Answers

Hello,

This sounds like your MySQL server is being killed. Most likely due to the lack of available RAM.

Make sure to optimize your site so it uses less RAM and maybe consider increasing your RAM as well. Another thing you could do is to add a swap file so that there's some buffer.

Hope that this helps!
Bobby

We can display error message in case of an error generated by mysql query. This meaning full error message gives idea one the problem or bugs in the script. We can print the error message by using mysql function mysql_error(). This function returns the error message associated with most recently executed query.

Have another answer? Share your knowledge.