frenchpl Posted January 26, 2017 Share Posted January 26, 2017 HiI am migrating my mysql database from windows xp to centos 6.I have the database up and running on the linux.However I cannot connect to it through firefox as I usually do on windows.I am pretty sure that my PHP scripts are OK and this is a configuration issue.Reading the error logs I find that it is trying to connect via /var/lib/mysql/mysql.sock and cannot find it[Thu Jan 26 08:14:19 2017] [error] [client ::1] PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /var/www/htdocs/HomeLogIn.php on line 87, referer: http://localhost/HomeLogIn.phpThe correct location is of course /var/run/mysqld/mysql.sockThere is obviously a configuration file somewhere that is setting the wrong path info, however I cannot find it./etc/my.cnf is correct as is /etc/php.ini to the best of my knowledge------------------------------------------------my.cnf[client]port=3306socket = /var/run/mysqld/mysql.sock# SERVER SECTION[mysqld]# The TCP/IP Port the MySQL Server will listen onport=3306socket = /var/run/mysqld/mysql.sock#Path to the database rootdatadir="/var/lib/mysql/mysql"--------------------------------I checked the /etc/httpd content and that seemed OK too.Obviously I am missing one somewhere but where, any thoughts please?I tried restarting Mysql with no effect at all.In fact shutting down the machine and restarting it makes no difference either. Quote Link to comment https://forums.phpfreaks.com/topic/303037-cannot-find-my-sock/ Share on other sites More sharing options...
Jacques1 Posted January 26, 2017 Share Posted January 26, 2017 The mysql_* functions are ancient and have been removed from the latest PHP branch. Use PDO and specifiy the socket path either in the DSN string or in the PHP configuration. Quote Link to comment https://forums.phpfreaks.com/topic/303037-cannot-find-my-sock/#findComment-1542016 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.