Software⏱️ 2 min read📅 2026-05-30

How to Fix ERROR 1698 Error – ERROR 1698 (28000): Access denied for user 'root'@'localhost'

MySQL root user access denied due to missing password. Check the mysql.user table for correct credentials.

Quick Answer: Check the mysql.user table for the correct root user password, as it may be set to an empty string or not set at all.

The error 'ERROR 1698 (28000): Access denied for user 'root'@'localhost'

🛑 Root Causes of the Error

  • The root cause of this issue is typically due to one or more of the following reasons:

🚀 How to Resolve This Issue

Method 1: Granting Privileges to the Root User

  1. Step 1: Access the MySQL command-line interface and run the following query: mysql -u root -e 'GRANT ALL PRIVILEGES ON *.* TO ''root''@'localhost' IDENTIFIED BY 'your_password';'

Method 2: Changing the Root Password

  1. Step 1: Access the MySQL command-line interface and run the following query: mysql -u root -e 'ALTER USER ''root''@'localhost' IDENTIFIED BY 'your_password';'

✨ Wrapping Up

To summarize, the issue can be resolved by granting privileges to the root user or changing their password. Make sure to replace 'your_password' with a secure and unique password for your MySQL server.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions