1. Post #1
    Aciidsneaker's Avatar
    July 2010
    2 Posts
    I know this seems to be an issue but I can not seem to figure it out, I've spent hours looking at the same line of code and getting nothing, please help.

    Code:
    Warning: mysql_connect() [function.mysql-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\db_ch03-1.php on line 3
    
    Warning: mysql_connect() [function.mysql-connect]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\db_ch03-1.php on line 3
    
    Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\db_ch03-1.php on line 3
    and this is the code

    Code:
    <?php
    //connect to MySQL
    $db = mysql_connect( 'localhost', 'bp6am', 'bp6ampass') or
    	die ('Unable to connect. Check your connection parameters.');
    
    //create the main database if it doesn't already exist
    $query = 'CREATE DATABASE IF NOT EXISTS moviesite';
    mysql_query($query, $db) or die(mysql_error($db));
    
    //make sure our recently created database is the active one
    mysql_select_db('moviesite', $db) or die(mysql_error($db));

  2. Post #2
    Gold Member
    Xeon06's Avatar
    September 2005
    1,222 Posts
    Well it can't connect to your database. Do you have MySQL running?

  3. Post #3
    Aciidsneaker's Avatar
    July 2010
    2 Posts
    I do have the service running, I also created the user using MySQL Administrator as well as tried

    Code:
    $db = mysql_connect( 'localhost:3306', 'bp6am', 'bp6ampass') or
    	die ('Unable to connect. Check your connection parameters.');

  4. Post #4
    Gold Member
    Benjy355's Avatar
    January 2006
    264 Posts
    It's not your PHP, although on the die it should echo the mysql_error(), (not getting called anyway) it's the SQL, make sure your firewall for some reason isn't blocking local connections, and blah blah blah make sure the SQL is actually -snipping- (Duhrr don't mind me not reading responses). (Check with PHPMyAdmin?)

  5. Post #5
    Gold Member
    midlet_guy's Avatar
    February 2007
    1,612 Posts
    Web Programming !!!!
    Reply With Quote Edit / Delete Reply Lithuania Show Events Agree Agree x 2Dumb Dumb x 1 (list)

  6. Post #6
    vladh_____'s Avatar
    July 2010
    13 Posts
    Your mysql is down.

  7. Post #7
    Gold Member
    Nisd's Avatar
    October 2008
    435 Posts
    It is pretty simple, it can't connect to the database. Could be things like firewall or such.

  8. Post #8
    Dragon Member
    Dragory's Avatar
    January 2006
    1,312 Posts
    Try using 127.0.0.1 instead of localhost.