hjf Posted June 5, 2008 Report Share Posted June 5, 2008 I am trying to access MySQL using PHP. I get an error message stating access is denied for user '-uroot'@'localhost'. The '-uroot' and '-proot' worked fine in the MySQL console. Are they different if I'm accessing MySQL using PHP? Here's the part of the code where I put in username and password: <?php /* Program: mysql_up.php * Desc: Connects to MySQL Server and * outputs settings. */ echo "<html> <head><title>Test MySQL</title></head> <body>"; $host="localhost"; $user="-uroot"; $password="-proot"; $cxn = mysqli_connect($host,$user,$password); $sql="SHOW STATUS"; $result = mysqli_query($cxn,$sql); if($result == false) Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Ric Posted June 5, 2008 Report Share Posted June 5, 2008 Yes they are different should be something like this: // Database configuration file config_db.php$dbhost = 'localhost'; //server name localhost or 127.0.0.1$dbuser = 'root'; //User name default root $dbpass = 'fred123s'; //Password default root -- I will be using ''fred123''?> For more info check out: http://wiki.uniformserver.com/index.php/Ne...rs:_Quick_MySQL All the bestRic Quote Link to comment Share on other sites More sharing options...
hjf Posted June 5, 2008 Author Report Share Posted June 5, 2008 Yes they are different should be something like this: <? // Database configuration file config_db.php$dbhost = 'localhost'; //server name localhost or 127.0.0.1$dbuser = 'root'; //User name default root $dbpass = 'fred123s'; //Password default root -- I will be using ''fred123''?> For more info check out: http://wiki.uniformserver.com/index.php/Ne...rs:_Quick_MySQL All the bestRic Thanks. I followed the link and realized I needed to set a password. So I followed the link to change the password and managed to follow the instructions for changing the MySQL root password. However, the stop.bat file I have doesn't stop the server. I had to restart the computer. Also, your last instruction "Restart the servers and check access using phpMyAdmin (left menu in apanel)" needs a few more words of explanation because once I get to phpMyAdmin, I don't see anything that tells me where to put the new password. Nevertheless, I retried the script and it worked. Thanks again. Quote Link to comment Share on other sites More sharing options...
Ric Posted June 6, 2008 Report Share Posted June 6, 2008 Thanks for the feedback; I have added a few more works to the section you mentioned. You stated, “the stop.bat file I have doesn't stop the server.” this is a known bug and easily fixed follow the instructions on the following page: http://wiki.uniformserver.com/index.php/Bu...ollo:_Close_bat All the bestRic Quote Link to comment Share on other sites More sharing options...
hjf Posted June 21, 2008 Author Report Share Posted June 21, 2008 Thanks for the feedback; I have added a few more works to the section you mentioned. You stated, “the stop.bat file I have doesn't stop the server.” this is a known bug and easily fixed follow the instructions on the following page: http://wiki.uniformserver.com/index.php/Bu...ollo:_Close_bat All the bestRic This is a link to the close.bat file. I did a search for stop.bat bug fix but couldn't find a file to download. Quote Link to comment Share on other sites More sharing options...
Ric Posted June 21, 2008 Report Share Posted June 21, 2008 This is a link to the close.bat file. I did a search for stop.bat bug fix but couldn't find a file to download. There is no problem with stop.bat; when run it indirectly runs Close.bat this is where the problem is. The file to download is Close.bat.txt when you click this link it will open a text page in your browser. Save the page as Close.bat and place in folder *\Uniform Server\udrive\home\admin\program Note: Batch files are very powerful and potentially harmful because of this certain security software won’t let you down load them hence the .txt extension All the bestRic Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.