Techiio-author
Started by Bell GrantNov 7, 2021

Open
I cant access my MYSql server with my app SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)

1 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 1 VIEWES SHARE

So I made an app that has a log-in script and I'm using a wamp server. I want to put users into the MySQL database. Once I run my script using a log-in form I get this error: sqlstate[HY000] [1045] get right of entry to denied for user 'root'@'localhost' (the use of password: no).

1 Replies

Techiio-commentatorArchana Behera replied 3 months ago0 likes0 dislikes

This error message usually appears for new installations of MySQL when you try to connect to MySQL with the root user.

When you install MySQL and try to access it on the local machine with the root user, the command you use is:

mysql -u root -p

In most cases, you will get this type error message Access denied for user ‘root’@’localhost’.

Next you can enable access for root using one MySQL command.

sudo mysql

Then enter your password at the prompt.

Use the ALTER USER command and change the authentication method to log into MySQL as root:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'insert_password';

This command changes the password for the user root and sets the authentication method to mysql_native_password. This is a traditional method for authentication, and it is not as secure as auth_plugin. In the example above, we set “root” as the password, but we encourage you to set a stronger password.

You must be Logged in to reply
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance