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

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

de Alek Steva -
Número de respuestas: 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!


Promedio de valoraciones: -
En respuesta a Alek Steva

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

de Dave Emsley -

Does the user root have a password?

Have you tried without the -p?



En respuesta a Dave Emsley

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

de 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.



En respuesta a Alek Steva

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

de Howard Miller -
Imagen de Core developers Imagen de Documentation writers Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de 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


En respuesta a Howard Miller

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

de Alek Steva -

Thanks a lot, since sudo did a trick sonrisa

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

Great, thanks, thanks...