Config Router

  • Google Sheets
  • CCNA Online training
    • CCNA
  • CISCO Lab Guides
    • CCNA Security Lab Manual With Solutions
    • CCNP Route Lab Manual with Solutions
    • CCNP Switch Lab Manual with Solutions
  • Juniper
  • Linux
  • DevOps Tutorials
  • Python Array
You are here: Home / MySQL: Access denied for user ‘test’@’localhost’ (using password: YES) except root user

MySQL: Access denied for user ‘test’@’localhost’ (using password: YES) except root user

August 16, 2021 by James Palmer

Do not grant all privileges over all databases to a non-root user, it is not safe (and you already have “root” with that role)
GRANT ON database.* TO ‘user’@’localhost’ IDENTIFIED BY ‘password’;

This statement creates a new user and grants selected privileges to it.
I.E.:
GRANT INSERT, SELECT, DELETE, UPDATE ON database.* TO ‘user’@’localhost’ IDENTIFIED BY ‘password’;

Take a look at the docs to see all privileges detailed
EDIT: you can look for more info with this query (log in as “root”):
select Host, User from mysql.user;

To see what happened

If you are connecting to the MySQL using remote machine(Example workbench) etc., use following steps to eliminate this error on OS where MySQL is installed
mysql -u root -p

CREATE USER ‘<>’@’%%’ IDENTIFIED BY ‘<>’;
GRANT ALL PRIVILEGES ON * . * TO ‘<>’@’%%’;
FLUSH PRIVILEGES;

Try logging into the MYSQL instance.
This worked for me to eliminate this error.

Related

Filed Under: Uncategorized

Recent Posts

  • How do I give user access to Jenkins?
  • What is docker volume command?
  • What is the date format in Unix?
  • What is the difference between ARG and ENV Docker?
  • What is rsync command Linux?
  • How to Add Music to Snapchat 2021 Android? | How to Search, Add, Share Songs on Snapchat Story?
  • How to Enable Snapchat Notifications for Android & iPhone? | Steps to Turn on Snapchat Bitmoji Notification
  • Easy Methods to Fix Snapchat Camera Not Working Black Screen Issue | Reasons & Troubleshooting Tips to Solve Snapchat Camera Problems
  • Detailed Procedure for How to Update Snapchat on iOS 14 for Free
  • What is Snapchat Spotlight Feature? How to Make a Spotlight on Snapchat?
  • Snapchat Hack Tutorial 2021: Can I hack a Snapchat Account without them knowing?

Copyright © 2025 · News Pro Theme on Genesis Framework · WordPress · Log in