ERROR 1045 (28000) MYSQL

Asked

Viewed 609 times

-1

I’m starting with the back-end and I’m having a hard time installing mysql, after installing and doing all procedures while trying to run the mysql the following error appears (it is worth mentioning that I run with sudo)...

first type in terminal

$ sudo mysql

and returns the following error:

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

Someone can explain me in detail, how to install correctly, because I’ve watched and read a lot of content but always gives the same error. Thank you

  • 2

    This is no error in the installation, the command mysql is without parameters there in your "test", so he is not accessing anything, or I got it wrong.

  • @Guilhermenascimento as I do to pass the parameters, could help me?

  • 1

    @Gustavodazzle, when you installed Mysql set up a password?

  • @Luizfelipe no, I just gave the command install msql-server and waited to install.

  • 1

    This is a support issue, not a programming issue. Basically you are trying to use invalid credentials, the error indicates that you have not tried any password. It’s a matter of reading the command line client manual. Additionally, if you search for the bug, you’ll see some posts dealing with the subject (including how to change the password).

  • What commands? What do you want to do with the mysql command? This has nothing to do with Node.js, Node.js has lib for mysql and has nothing to do with the line command.

Show 1 more comment

1 answer

1

The problem is that you are probably not passing the correct "login" credentials, that is, the username and password.

The default user is root. Then you can try:

mysql -u root -p

The flag -u determines the user I want to connect to. And the flag -p will open a prompt for me to enter the password as soon as I execute the command. If you have not set up a password, it can be empty (just press Enter) or simply root).

To know all the flags of mysql, execute mysql --help.

  • Right, explained very well... I managed to understand the command, thank you for that. But, I had already seen it (I just didn’t understand). Is there any way I can reconfigure this root password? pq is not working

  • See if the mysql documentation help you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.