MySQL Forums
Forum List  »  Install & Repo

Re: ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost' (10061)
Posted by: L RLJ
Date: September 28, 2010 11:16AM

UPDATE: I've now got MySQL running and can access it from command line, however I still get the first error message when trying to connect via PHP. Any ideas what could be causing this?

My PHP script is as follows:
----------------------------------------------------------------------------------
<?php

$link = mysql_connect ('localhost', 'root', 'PASSWORD');

if (!$link) {
die('Could not connect: ' . mysql_error());
}
else {
print 'successful';
}
mysql_close($link);

?>
----------------------------------------------------------------------------------


The only thing I wasn't sure about was the username 'root', when installing MySQL it never asked me for a username. Could this or something else in the PHP script be the issue? or is there something wrong with the way I have set up PHP/MySQL/Apache?

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.