npsari Posted April 28, 2007 Share Posted April 28, 2007 I moved to a different hosting company and now, all my mySQL connections are failing I dont know why!!! the username and password are the same I always get this message: Could not connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (46) Do you know what is going on Link to comment https://forums.phpfreaks.com/topic/49084-mysql-situation-moved-to-a-new-hosting-company/ Share on other sites More sharing options...
steelmanronald06 Posted April 28, 2007 Share Posted April 28, 2007 Did the host change? Some hosts make you use localhost and others make you use something like: mysql1.hostingcompany.tld Link to comment https://forums.phpfreaks.com/topic/49084-mysql-situation-moved-to-a-new-hosting-company/#findComment-240481 Share on other sites More sharing options...
fanfavorite Posted April 28, 2007 Share Posted April 28, 2007 Can you post your code? Are you using "localhost". What kind of server was your old hosting company and what is it now? For example: Unix, Linux, Windows. The error seems to be that the default socket path is different. I would contact your host about this, unless you have telnet/ssh knowledge and access. Link to comment https://forums.phpfreaks.com/topic/49084-mysql-situation-moved-to-a-new-hosting-company/#findComment-240482 Share on other sites More sharing options...
npsari Posted April 28, 2007 Author Share Posted April 28, 2007 Ohh, really? So, Does that mean this code will not work... $con = mysql_connect("localhost","name","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); because this is what I am using with my pages Link to comment https://forums.phpfreaks.com/topic/49084-mysql-situation-moved-to-a-new-hosting-company/#findComment-240484 Share on other sites More sharing options...
steelmanronald06 Posted April 28, 2007 Share Posted April 28, 2007 See, you have localhost. Your new host provider might not have localhost as a valid mysql database host. It might be a subdomain like i showed you above. Read the emails you got on signup. They should explain it. If you have cpanel, click the MySQL icon and it shows you the database host url. If all else fails, contact support and ask them. Link to comment https://forums.phpfreaks.com/topic/49084-mysql-situation-moved-to-a-new-hosting-company/#findComment-240614 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.