Home >Database >Mysql Tutorial >Why Am I Getting a MySQL 'Access Denied' Error for Non-Root Users?
MySQL Access Denied for Non-Root Users: A Comprehensive Guide
Introduction
MySQL, a widely used relational database management system, provides user account management to control access to databases. However, non-root users sometimes encounter an access denied error when attempting to log in. This article aims to address this issue, exploring the steps involved in creating non-root users and troubleshooting the access denied error.
Creating Non-Root Users in MySQL
To create a non-root user, follow these steps:
mysql -u root -p
CREATE USER 'golden'@'%' IDENTIFIED BY 'password';
GRANT <privileges> ON database.* TO 'golden'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
Troubleshooting Access Denied Errors
If a non-root user receives an access denied error, check the following:
Best Practices
By following these steps, you can effectively create and troubleshoot non-root users in MySQL, ensuring secure access to databases for various user profiles.
The above is the detailed content of Why Am I Getting a MySQL 'Access Denied' Error for Non-Root Users?. For more information, please follow other related articles on the PHP Chinese website!