Can't connect to MySQL server on 'localhost' (10061)
Posted by: wlfoff (79.92.62.---)
Date: May 14, 2010 03:16PM

What should I do to solve the following error. The past 2 days I have read most of the forums that treat similar errors but i couldn't fix the problem. Maybe you could help me here. I would be very grateful. Thanx in advance

Warning: mysql_pconnect() [function.mysql-pconnect]: Can't connect to MySQL server on 'localhost' (10061) in D:\Hosting\5619974\html\Connections\movie.php on line 9

Fatal error: Can't connect to MySQL server on 'localhost' (10061) in D:\Hosting\5619974\html\Connections\movie.php on line 9

this is the code:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_movie = "localhost";
$database_movie = "moviedb";
$username_movie = "root";
$password_movie = "password";
line 9 -> $movie = mysql_pconnect($hostname_movie, $username_movie, $password_movie) or trigger_error(mysql_error(),E_USER_ERROR);


?>

Re: Can't connect to MySQL server on 'localhost' (10061)
Posted by: bdavis96 (---.virtual.state.nv.us)
Date: May 14, 2010 07:19PM

<?php

# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_movie = "localhost";
$database_movie = "moviedb";
$username_movie = "root";
$password_movie = "";
$movie = mysql_pconnect($hostname_movie, $username_movie, $password_movie);

if (!$movie) {
echo "Could not connect to mysql!";
} else {
echo "Connected!";
}

?>

Using WAMP Server configured as Apache 2.2.14, PHP 5.3.1, and MySQL 5.1.41, changing the variables above to fit my WAMP Server configuration, adding the moviedb to MySQL, everything worked just fine for me. I did take out the trigger_error and added the if statement just to make sure I was connecting, but that shouldn't matter in your script.

Suggestions:
1) Double check the username="root" and password="password". MySQL in WAMP Server comes default with root having no password (password="" ). If you changed the default configuration, double check that you are using the correct user and password.

Re: Can't connect to MySQL server on 'localhost' (10061)
Posted by: yfastud (Moderator)
Date: May 14, 2010 10:44PM

first, your project folder is not in the default document root c:/wamp/www

second, did you create db account yet? if not, follow this

to setup db acct, follow this
[blog.jlbn.net]

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

can't submit form to my database table
Posted by: ashamide (---.lg.starcomms.net)
Date: July 20, 2010 02:51PM

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in C:\wamp\www\sirsunsco\insert.php on line 10


insert.php code

<?php
$con = mysql_connect("localhost","root","ashamide"winking smiley;
if(!$con)
{
die('connection failed:'.mysql_error());
}
mysql_select_db("maliki",$con);
$sql="INSERT INTO order_form(FIRSTNAME,LASTNAME,EMAIL ADDRESS)
VALUES
('$_POST[firstname]','$_POST[lastname]','$_POST[EMAIL ADDRESS]')";
if(!mysql_query(sql,$con))
{
die('the server is down:'.mysql_error());
}
echo "succesful";
mysql_close($con)
?>

Sorry, only registered users may post in this forum.