php/mysql

Discussion in 'Software' started by man_im_bored, May 20, 2004.

  1. man_im_bored

    man_im_bored Private E-2

    I've recently formatted my hardrive, and now i've reinstalled php and mysql. however, when i try to connect to mysql in php i get the error

    Warning: mysql_connect(): Access denied for user: 'dave@localhost' (Using password: YES) in c:\inetpub\wwwroot\test\index.php on line 6
    Could not connect


    The script is

    Code:
    <?PHP 
    $hostname = "localhost";
    $db_login = "name";
    $db_pass = "password";
    $database = "mysql";
    $dbase_link = mysql_connect($hostname, $db_login, $db_pass) or die("Could not connect");
    		mysql_select_db($database) or die("Could not select database");
    
    		$query = "SELECT * FROM  db";
    		$result = mysql_query($query) or die("Query failed");
    
    		$line = mysql_fetch_array($result);
    		echo "$line[host]";
    		
    	mysql_close($dbase_link);
    		 ?>
    Yet, if i take off the die() function, it'll actually connect and return query's etc, but still display the error's.

    I've got PHP 4.3.6 and mysql 4.0.18.

    Any ideas?

    (I KNOW for a fact it's not the username or password, cause i have looked @ the mysql.ini file...)
     
  2. man_im_bored

    man_im_bored Private E-2

    For future reference, even though it was agans't my religion and belief, i decided to put the username and password in blank...REGARDLESS of the fact that i have indeed written in a username and password...and it worked.

    sigh....but still, it works :)
     
  3. goldfish

    goldfish Lt. Sushi.DC

    Yeah, mysql has its own user-database, not the ini file. you might wanna change that password soonish! :)
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds