Warning Mysql_Connect Access Denied for User

Home » Warning Mysql_Connect Access Denied for User

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Warning Mysql Connect Access Denied for User 1

The ERROR 1698 (28000): Access denied for user “root”@”localhost” was experienced by the majority of Warning Mysql_Connect Access Denied for User. When you attempt to connect to MySQL as the root user on a new installation, this error message frequently appears.

Blue And White Modern Creative Digital Marketing Outdoor Banner

You can rapidly fix the access denied for user root on the localhost issue by following the instructions in this manual. The described procedures are valid for both MariaDB and MySQL. There won’t be a requirement for intricate arrangements or table modifications.

  1. Access to a terminal or command line
  2. Installation of MariaDB or MySQL
  3. User with root or sudo rights

How to Access MySQL as Root?

The command you use when installing MySQL and attempting to access it on a local machine as the root user is:

  • MySQL -u root –p

The error message of Warning Mysql_Connect Access Denied for User “root”@”localhost” will typically appear.

One MySQL command will enable root access.

Fix Error Access Denied For User Root

Use sudo to change the root user before you can log into MySQL as root:

  • enter MySQL

In the space provided, type your password. The MySQL shell starts up.

To log into MySQL as root, use the ALTER USER command and modify the authentication strategy:

  • ALTER USER "root"@"localhost" IDENTIFIED BY "MySQL native password" "insert password" BY;

With this command, the root user’s password is updated, and MySQL native password is selected as the authentication method. This is a conventional authentication mechanism, and it is less safe than auth plugin.

Although we used “root” as the password in the aforementioned example, we strongly advise you to choose something more secure.

Test Root User Access to MySQL

After executing the aforementioned instructions, end the MySQL shell by typing exit and pressing enter or by pressing CTRL + D on your keyboard. In order to log in, the MySQL service does not need to be restarted.

Now attempt to access MySQL as root once more. the following into the terminal:

  • MySQL -u root –p

The password you entered when you executed the ALTER USER command. Entering the system password will not allow you to access MySQL. The welcome message from MySQL should appear if everything went according to plan.


You now understand how to avoid MySQL ERROR 1698 (28000): For the user “root”@”localhost,” Warning Mysql_Connect Access Denied for User.

There are various approaches to solving this problem, but we chose the quickest and most straightforward one. To prevent SQL syntax errors, be sure to type the commands exactly as they are described in the article.


Share on facebook
Share on twitter
Share on pinterest
Share on linkedin
On Key

Related Posts