Log in

View Full Version : ERROR 1045, Access denied for user 'root'


erog84
04-19-2014, 05:43 PM
I saw other threads that had the same issue, but none of the fixes applied there are seeming to work for me. I have a batch file that is supposed to launch the server but am having issues there. Currently root does not have a password in mysql, I can log in via command window without using one, and if I try using one, it won't work. I have a screenshot of the errors, but since I can't post attachments I will type it up.

Error in DOS window after running batch file to start server

Status Starting Log: logs/eqemu_shared_memory_4560.log
Status Shared Memory Loader Program
Status Connecting to database...
Error Starting Log: logs/eqemu_error_shared_memory_4560.log
Error Failed to connect to database: Error: #1045: Access denied for user 'root'@'localhost' (using password: YES)
Error Unable to connect to the database, cannot continue without a database connection
waiting for the world to finish before starting zone...



My config file has the following:

<database>
<host>localhost</host>
<port>3306</port>
<username>root</username>
<password></password>
<db>peq</db>
</database>


If anyone that knows much about this doesn't mind doing a skype/dolbyx(or I can install another program) I would really appreciate it (also posting possible fixes works too!). And currently this will be a local server, if I open it up to friends, I will be adding a password onto root :)

Kingly_Krab
04-19-2014, 07:21 PM
It's a database connection error. You probably have a password on the root account, which must be present there if you do.
Error Failed to connect to database: Error: #1045: Access denied for user 'root'@'localhost' (using password: YES)
That means it has a password, but you're giving it the wrong one, currently just "".

erog84
04-19-2014, 07:38 PM
When I open up a dos command window and go connect to the mysql server

"mysql -u root " this works just fine, but if I try to give it a password it fails. Is there any other way to verify if I have a password on it? I did a query for password column for root user and it returned 3 values (they are just long random strings).

sarxosen
04-19-2014, 08:14 PM
login to mysql as you did with no root password. type the following, replacing the myrootpw with whatever password you want.

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('myrootpw');

then put the password in your config file. its not worth running without a root pw, even if you make it really simple. give it a try.

erog84
04-19-2014, 08:17 PM
Thanks man, that got it. Really appreciate the assistance.

Valorborn
05-02-2014, 10:36 PM
Where is the config file in question located at? Also the 1045 error message says the password it is trying to use is YES, if I reset the uroot password to YES will it just work?

Respectfully,


Ephron

Valorborn
05-03-2014, 12:57 AM
1) I opened the my.ini file through XAMPP and selected 'config'. I did a ctrl + F for password but none of the matches where on a line that wasn't a comment.

I stopped the sql service and closed XAMPP - no change on restart

2) I clicked on explorer in XAMPP and saw a passwords.txt file in the XAMPP install directory. Top of the file had user: root and password (blank) so I set that to my uroot password.

I stopped the sql service and closed XAMPP - no change on restart

3) I read the readme file in the SQL folder but the little I could understand from it didn't seem to be relative to a 1045 error.

4) I checked world.exe's permissions under security and gave everyone full control - no change.


I'm going to keep working at it, hopefully I'll find the answer before someone posts it. I mean, database administration isn't too different from domain administration right =P shouldn't be too hard.

lerxst2112
05-03-2014, 01:18 AM
I googled for 'set root password xampp' and found https://www.apachefriends.org/faq_windows.html which explains exactly how to do it.

Don't use 'YES' as your password, that isn't what the error is telling you.

Valorborn
05-03-2014, 01:47 AM
lerxst2112 the setup guide has you run the command: SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your_pasword'); which worked as I was able to build the database in the later steps.

I can access the database with the command: mysql -uroot -pyourpassword peq with out issue (I set a password), but I am going to run the comand in the XAMPP guide you sent me.

Edit:
I ran "mysqladmin.exe -u root password secret" where I changed 'secret' to a new password and I still receive Error: #1045

Thanks for the attempt though man.

On a side note, if i select Shell from XAMPP Control Panel the prompt and run the above command returns Access denied for user 'root'@'localhost' (using password: NO)' but the same command did not return an error from a cmd prompt opened from the start menu.

Also: http://localhost/phpmyadmin/ and /security windows open as blank pages. (the page was blank because skype was using port 443 and it wouldn't let apache start) After I closed skype the page came up with "ACCESS DENIED Error: 1045)

As this was an XAMPP issue it was easy to find an answer: http://www.ostraining.com/blog/coding/error-1045-phpmyadmin/

I corrected the localhost/phpadmin issue by editing the password in config.inc.php and was able to access the php admin console. I see what was meant by the password used =yes or no. So I went into the users area and changed the password of the localhost that had a password set to YES to the password I set for my sql root account. I also made a new user account named eq@localhost (my 1045 error says access denied to eq@localhost) then i stopped and restarted sql, apache, and XAMPP, and that didn't work so I restarted my computer. That didn't work either so I came back to update my post with my new failure.