1045 access denied for user - MySQL error

Avatar
  • Answered
I am trying to run a query on one of my databases, and I am getting the following error: "#1045 - Access denied for user '[My username]'@'localhost' (using password: YES)". I think that in order to fix this I need to reset my password in the config.inc.php file.

Is this what I need to do to fix this problem, and if so, how do I access the config.inc.php file???

Thank you in advance.
Avatar
-1
BradM
Hi jdgrimes, If your account is on a shared server (which it appears yours is), you actually do not have access to update any settings within phpMyAdmin. This is because in a shared server, those changes you would make would affect all other users in the shared server. #1045 - Access denied for user Your cPanel username and password can be used to connect to your databases (as well as your cPanel). If you're connecting to your database using your cPanel username and password, you can reset your cPanel password to ensure you are using the correct username and password. If you setup a MySQL username and password specifically for accessing a database, you'll want to ensure you are using the correct username in your php scripts. For example, MySQL usernames are always in this format: cpanel-username_mysql-username If your cPanel username is userna5 and you created a database username of dbuser1, then the actual database username would be: userna5_dbuser1 When connecting to a database, you need to ensure that: 1. You've created a database 2. You've created a database username 3. You've assigned that user with privileges to your database All three of these steps can be done easily within the MySQL database wizard within your cPanel. If you already have the database created however, you can create a new user and assign it to your database by logging into your cPanel and clicking the MySQL Databases icon. From this screen, you can also reset your MySQL user's password. I hope this helps point you in the right direction. If you need further help, feel free to post a comment at the bottom of this page with more details. Thanks! - Brad