Most of the time everything is fine and dandy. But, it seems that once a while, about once a day, for a few seconds, I get this error. I’ve had multiple users report this to me.
Warning: mysql_pconnect() [function.mysql-pconnect]: Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (2) in /home/gameany/public_html/includes/functions.php on line 20
Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (2)
The database is running on the same server as my PHP code.
Any idea why this would be happening?
that error message means the mysql server is not running. Are you on a shared host? find out if they have a scheduled restart of the mysql server. If it is your own machine check the error logs.
It was running fine for a while, then it failed, so I restarted mysql and it started working again. Here is the error log. I can’t tell if anything is wrong from this… maybe someone can help?
110821 06:43:13 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
110821 6:43:13 [Note] Plugin 'FEDERATED' is disabled.
110821 6:43:13 InnoDB: Initializing buffer pool, size = 8.0M
110821 6:43:13 InnoDB: Completed initialization of buffer pool
110821 6:43:13 InnoDB: Started; log sequence number 0 1051539
110821 6:43:13 [Note] Event Scheduler: Loaded 0 events
110821 6:43:13 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.56-log' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
110826 20:01:50 [Note] /usr/sbin/mysqld: Normal shutdown
110826 20:01:50 [Note] Event Scheduler: Purging the queue. 0 events
110826 20:01:52 InnoDB: Starting shutdown...
110826 20:01:56 InnoDB: Shutdown completed; log sequence number 0 1051539
110826 20:01:56 [Note] /usr/sbin/mysqld: Shutdown complete
110826 20:01:56 mysqld_safe mysqld from pid file /var/lib/mysql/mywebsite.com.pid ended
110826 20:01:58 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
110826 20:01:58 [Note] Plugin 'FEDERATED' is disabled.
110826 20:01:58 InnoDB: Initializing buffer pool, size = 8.0M
110826 20:01:58 InnoDB: Completed initialization of buffer pool
110826 20:01:58 InnoDB: Started; log sequence number 0 1051539
110826 20:01:58 [Note] Event Scheduler: Loaded 0 events
110826 20:01:58 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.56-log' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
I edited the bit that says mywebsite. I don’t want to disclose my client’s website I am working on.