cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution
Highlighted

MySQL Error: #1045 - Access denied for user

I uploaded my website from dreamweaver to GoDaddy and realized many pages that had to access database were not uploading. After spending a few hours I found the solution, which I hope would be helpful to this community.

 

When you are uploading your database to GoDaddy, you need to follow three steps.

Step 1: Create a database in GoDaddy with the same name you had created in your local computer.

  • Login to your GoDaddy cPanel hosting
  • In Databases click on "MySQL Databases"
  • In "Create New Database" type the same name you had used in your localhost for your database
  • Click on "Create Database"Screen Shot 2017-08-08 at 1.25.26 AM.png

     

     

Step 2: Create a user and password in GoDaddy with the same credential you had used in your local computer. 

  • Return to the same GoDaddy page that you just created your database
  • Scroll down to "MySQL Users", "Add New User"
  • Fill in the user name and password fields with the same credential you used for your localhost (Note: if your localhost used a generic username such as "root" and no password, MAKE SURE TO SET A STRONG USER NAME AND PASSWORD IN GODADDY DATABASE!"
  • Click on "Create User"Screen Shot 2017-08-08 at 1.25.51 AM.png

     

     

Step 3: Last but certainly not least, add user to the database you created in GoDaddy.

  • Return to the same page as before
  • Scroll down to "Add User To Database" section
  • From "User" and "Database" drop downs, select user and database you just created
  • Click "Add"Screen Shot 2017-08-08 at 1.26.01 AM.png

     

     Make sure to update your php connection credentials as follow:

    <?php
        $connect = new mysqli("localhost", "username", "password", "dbname");
    ?>

    That's it!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager
Community Manager
Solution

Re: MySQL Error: #1045 - Access denied for user

Hey @servinghim. Welcome to GoDaddy Community and thanks for taking the time to share your solution! I'm sure someone will find it helpful! 

 

JesseW - GoDaddy | Community Manager | 24/7 support available at x.co/247support | Remember to choose a solution and give kudos.

View solution in original post

8 REPLIES 8
Highlighted
Community Manager
Community Manager
Solution

Re: MySQL Error: #1045 - Access denied for user

Hey @servinghim. Welcome to GoDaddy Community and thanks for taking the time to share your solution! I'm sure someone will find it helpful! 

 

JesseW - GoDaddy | Community Manager | 24/7 support available at x.co/247support | Remember to choose a solution and give kudos.

View solution in original post

Highlighted

Re: MySQL Error: #1045 - Access denied for user

I had followed the same step and added a user called sample to database sample. But when trying to connect I got the error "Connection failed: Access denied for user sample@localhost".

 

How to add privilege for that user, I am using cPanel

Highlighted

User Access getting revoked time and again

Since yesterday the User Access to the databases is getting constantly revoked every now and then, each time I have to add the user to the database through My SQL in C Panel. After a few hours once again the website is down with the "Database Connection Error" with user access revoked.  Can anyone help with why this is happening regularly.  Nothing has been changed to the website or wordpress installation.  Thanks 

Highlighted

Re: MySQL Error: #1045 - Access denied for user

In case it helps anybody, I was having the same issue and fixed by creating a new DB using the Database wizard ... then I moved the tables to the new DB using the "move table to" option in the "operation" section of phpMyAdmin

Highlighted

Re: MySQL Error: #1045 - Access denied for user

I followed all the instructions listed, but i still had error. Do you know what happens? This morning it worked fine, but in the evening somehow it spited out the Access denied error again. Please help. Thanks.

Highlighted

Re: MySQL Error: #1045 - Access denied for user

Great post. Your help here was better than GoDaddy complete support. 

Highlighted

Re: User Access getting revoked time and again

Hi,

I had face the same challenge. I created the database and add the privilege user to the database with all the privileges. The problem solved by changing the connection code on php. especially on host server, instead of putting real server such as xxx.com put localhost.

Hope someone will find this useful and kudos it.


@chennairains wrote:

Since yesterday the User Access to the databases is getting constantly revoked every now and then, each time I have to add the user to the database through My SQL in C Panel. After a few hours once again the website is down with the "Database Connection Error" with user access revoked.  Can anyone help with why this is happening regularly.  Nothing has been changed to the website or wordpress installation.  Thanks 


 

Highlighted

Re: MySQL Error: #1045 - Access denied for user

I am not able to add user to database it is diable for me... what to do?