Jump to content

error 1045 trying to log as 'root' but I am a different 'user' in config


harinezumi
 Share

Recommended Posts

Hello,

when moving the site from a local to a remote server, I can't log in with the user+password set up in my config.php:

Fatal error: Exception: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (in /home/…/public_html/pw/wire/core/ProcessWire.php line 216) #0 /home/…/public_html/pw/wire/core/ProcessWire.php(94): ProcessWire->load(Object(Config)) #1 /home/…/public_html/pw/index.php(232): ProcessWire->__construct(Object(Config)) #2 {main} in /home/…/public_html/pw/index.php on line 248

Why the hell is it trying to log in as 'root'@'localhost' when my config.php says:

/**
 * Database username
 *
 */
$config->dbUser = 'myusername';
/**
 * Database password
 *
 */
$config->dbPass = 'mypassword';
/**
 * Database host
 *
 */
$config->dbHost = 'mydbname';

Should'nt it send a request as 'myusername'? Why 'root'?

I tested many advice found in the forum without any luck:

export+import tables only, setting the local server with same username, db name and password, deleting cache…

The site is in a subdir (pw) so I also edited the .htaccess as in http://processwire.com/docs/tutorials/troubleshooting-guide/page3 (I did it on the .htaccess in the subdir, not the main dir).

Thank you

Link to comment
Share on other sites

Maybe try copying the User Authentication Salt from the local to remote server location

/**
 * Installer: User Authentication Salt 
 * 
 * Must be retained if you migrate your site from one server to another
 * 
 */
$config->userAuthSalt = 'xxxxxxxyourusersaltxxxxxxxxxxxx'; 
Link to comment
Share on other sites

Maybe try copying the User Authentication Salt from the local to remote server location

/**
 * Installer: User Authentication Salt 
 * 
 * Must be retained if you migrate your site from one server to another
 * 
 */
$config->userAuthSalt = 'xxxxxxxyourusersaltxxxxxxxxxxxx'; 

userAuthSalt is for PW's login system, but the error in the OP comes from MySQL. A few ideas to check: there might be another line further down in config.php where dbUser is set; something fishy may have gone on with the config file during the upload and it contains invalid characters; the entry for $dbUser in the mysql.user table may be limitied to 127.0.0.1 or % instead of localhost.

Link to comment
Share on other sites

userAuthSalt is for PW's login system, but the error in the OP comes from MySQL. A few ideas to check: there might be another line further down in config.php where dbUser is set; something fishy may have gone on with the config file during the upload and it contains invalid characters; the entry for $dbUser in the mysql.user table may be limitied to 127.0.0.1 or % instead of localhost.

I thought it should be on the config.php, because it always tryies to connect as root - so why shall the problem be on the database side?

I checked config.php: it has only one $config->dbUser - nothing happened.

Link to comment
Share on other sites

Both? do you mean local and remote? local has the the $config->dbUser, dbPass and dbHost all empty ''

But WAIT, now locally I get the error:

Parse error: syntax error, unexpected '$homepage' (T_VARIABLE) in /share/MD0_DATA/Web/en/site/templates/_init.php on line 37

what's going on????

:-(

I swear I dind't change a file locally (I added a user in the db)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...