MySQL won't connect from websites

enginaar

Verified User
Joined
May 20, 2004
Messages
158
Location
Turkiye
Hi,

I'm having an issue with connecting to mysql. Mysql process is up and running, I can connect and query using mysql in shell but websites and phpmyadmin won't connect. I've got the following settings.

[client]
port = 3306
socket = /var/lib/mysql/mysql.sock

[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock

And my ps result looks like below.

root 8218 0.0 0.0 11340 1688 pts/0 S 20:42 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --user=mysql --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/host.pid
mysql 8493 0.0 2.3 607780 95676 pts/0 Sl 20:42 0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/host.cozum.com.err --pid-file=/usr/local/mysql/data/host.pid --socket=/var/lib/mysql/mysql.sock --port=3306

I have also disabled csf to see if there is an issue with the firewall but still can't connect. In fact, I can connect to mysql remotely.

Logs also show that its up and running.
160713 20:42:29 InnoDB: Compressed tables use zlib 1.2.3
160713 20:42:29 InnoDB: Using Linux native AIO
160713 20:42:29 InnoDB: Initializing buffer pool, size = 128.0M
160713 20:42:29 InnoDB: Completed initialization of buffer pool
160713 20:42:29 InnoDB: highest supported file format is Barracuda.
160713 20:42:29 InnoDB: Waiting for the background threads to start
160713 20:42:30 InnoDB: 1.1.5 started; log sequence number 36201614193
160713 20:42:30 [Note] Event Scheduler: Loaded 0 events
160713 20:42:30 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.5.9' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)

I don't see what might be the reason. I appreciate your help.

Thanks,
Engin
 
Last edited:
For some reason php files trying to connect using /tmp/mysql.sock while mysql is configured to create it in /var/lib/mysql/mysql.sock. I don't know what may have changed suddenly but it's working now.
 
Back
Top