MySQL problem - ERROR 1045 (28000): Access denied for user 'root'@'localhost'

MySQL problem - ERROR 1045 (28000): Access denied for user 'root'@'localhost'

by Alek Steva -
Number of replies: 4

Hi all,

During Moodle installation, I'm not able to access MySQL with root's password, over putty from another vm.

Command mysql -u root -p, throws always next error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

When I'm on Moodle server itself (also vm), I can access MySQL without any problem.

Is there a way how to solve access to MySQL from putty on another vm?

Thanks a lot!


Average of ratings: -
In reply to Alek Steva

Re: MySQL problem - ERROR 1045 (28000): Access denied for user 'root'@'localhost'

by Dave Emsley -

Does the user root have a password?

Have you tried without the -p?



In reply to Dave Emsley

Re: MySQL problem - ERROR 1045 (28000): Access denied for user 'root'@'localhost'

by Alek Steva -

Yes, I've tried without -p and it doesn't work. Also, even bare mysql command throws the same error.

Just for clarification, on Ubuntu Moodle server, root password for MySQL has been setup during installation.

On Ubuntu Moodle server itself, it is possible to issue mysql-u root -p command and to enter root's password, but the problem is that I'm not an Ubuntu Moodle server's admin. I have only putty from my workstation to access the server on which I get the same error every time I issue MySQL...commands.



In reply to Alek Steva

Re: MySQL problem - ERROR 1045 (28000): Access denied for user 'root'@'localhost'

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

if you put -p on the end the next line will be...

Enter password:

If you don't type a password or type the wrong one, you get your error. You don't know the password - that's the obvious explanation. 

http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

Note, however, that newer versions of Ubuntu and derivatives are configured with 'no' initial root password but you have to be 'sudo' to gain access. So, the command you want might be...

sudo mysql -u root


Average of ratings: Useful (1)
In reply to Howard Miller

Re: MySQL problem - ERROR 1045 (28000): Access denied for user 'root'@'localhost'

by Alek Steva -

Thanks a lot, since sudo did a trick smile

Actually, I know the password, but was never able to get to Enter password line. With sudo, finally, I get it.

Great, thanks, thanks...