Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8101059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:53:36+00:00 2026-06-05T22:53:36+00:00

Access denied for user ‘root ‘@’localhost’ (using password: YES) Yes, this error is all

  • 0
Access denied for user 'root '@'localhost' (using password: YES)

Yes, this error is all too common, and I have spent much time researching it. However nothing solved the problem.

I get this error when attempting the first connect in one of my PHP scripts I’m developing. If it helps to know, I’m running Linux Mint with the LAMP configuration detailed at http://community.linuxmint.com/tutorial/view/486 installed.

The thing is, any other application works with connecting. Both logging into PhpMyAdmin as root or mysql client on the console as root work perfectly. The MySQL site itself says that it’s likely a problem with my code, but I have yet to figure that out… I am kinda new to this stuff so please forgive me if it’s a very nooby mistake.

I’m using an external function on a different page (imported with require_once). Is this a bad practice? Regardless, here it is:

global $sql_conn, $sql_addr, $sql_user, $sql_pass, $sql_datb;

$config=app_readconfig();
echo "<p>".$sql_addr." ".$sql_user." ".$sql_pass." ".$sql_datb."</p>";//DEBUG, shows values are read
if($config==FALSE)
{
    echo "<p>Error: Missing values in darkace_config.txt!</p>";
    return FALSE;
}
$sql_conn=mysql_connect($sql_addr,$sql_user,$sql_pass);
if(!$sql_conn)
{
    echo "<p>MYSQL Error: ".mysql_error()."</p>";
    return FALSE;
}

if(!mysql_select_db($sql_datb,$sql_conn))
{
    echo "<p>MYSQL Error selecting database: ".mysql_error()."</p>";
    return FALSE;
}
return TRUE;

That function is called, and the message I’m returned is:
MYSQL Error: Access denied for user ‘root ‘@’localhost’ (using password: YES)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:53:38+00:00Added an answer on June 5, 2026 at 10:53 pm

    You have ‘root[SPACE]’ as the user name. Try ‘root’ without the space?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N O) I've tried
Access denied for user 'root'@'localhost' (using password: YES) I setup a new environment where
I get the error #1045 - Access denied for user 'root'@'localhost' (using password: NO)
phpMyAdmin give this error. MySQL said: #1045 - Access denied for user 'root'@'localhost' (using
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'admin'@'localhost' (using password: YES) in C:\wamp\www\connect.php on
I am getting the following error: Access denied for user 'apache'@'localhost' (using password: NO)
I keep getting this error: Warning: mysql_query() [function.mysql-query]: Access denied for user 'mcabinet'@'localhost' (using
I'm getting Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'username'@'localhost' (using password: NO) Here's
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'dbuser1'@'localhost This is probably something stupid, but
I am using this connection string, <add name=connectionString connectionString=server=10.1.1.16;user id=root; password=lmslive; database=lmslive; pooling=false; providerName=MySql.Data.MySqlClient/>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.