Jump to content
The Uniform Server Community
hjf

username/password problems

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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 best

Ric :)

Share this post


Link to post
Share on other sites

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 best

Ric :)

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. :)

Share this post


Link to post
Share on other sites

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 best

Ric :)

Share this post


Link to post
Share on other sites

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 best

Ric :)

 

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.

Share this post


Link to post
Share on other sites

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 best

Ric :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...