How to Solve Error #1045 in phpMyAdmin

Hatem Hena by Hatem Hena
How to Solve Error #1045 in phpMyAdmin

After installing a local WAMP server and trying to access your phpMyAdmin, you may encounter the error:

#1045 Access Denied for user 'root'@'localhost' (using password: YES).

This may happen if your root@localhost database user was not granted the necessary rights to access the database. Or if you provided a wrong password.

In this tutorial, you will learn how to solve this error for the WAMP local server using phpMyAdmin.

If you get the #1045 Access Denied... in phpMyAdmin it will look like the image below:

tutuploadsphpMyAdmin-Access-Denied.png

Let's learn how to get rid of it.

Step #1. Open Your MySQL Console

tutuploadsmedia_1338949643300.png

  • Left click your WAMP icon located at the bottom right of your desktop.
  • Click on MySQL Console.

Step #2. Enter the Provided Commands

tutuploadsmedia_1338949812597.png

If you have a password, you can ignore this part.

  • Type in: 
    use MySQL;
  • Press Enter.
  • Set your MySQL password with the following command, replacing "EnterYourPasswordHere" with your new chosen password: 
    UPDATE mysql.user SET Password=PASSWORD("EnterYourPasswordHere") WHERE User="root";
  • Press Enter.
  • Flush the privileges by typing: 
    FLUSH PRIVILEGES;
  • Exit by typing: 
    Exit
  • Press Enter.

Step #3. Edit Your config.inc.php File

tutuploadsmedia_1338949961143.png

Using a text editor, such as Notepad++, open your config.inc.php file.

  • Go to My Computer > C Drive > (Your Local Server Folder, WAMP/MAMP/XAMPP) > APPS > PHPMYADMIN > config.inc.php
  • Find the following line of code: 
    $cfg['Servers'][$i]['password'] = ''; // MySQL password
  • Change the 'password' to the newly chosen password you created in Step #2.
  • Click Save.

Step #4. Access Your phpMyAdmin

tutuploadsphpmyadmin7.png

  • Go to http://localhost/phpMyAdmin and test your phpMyAdmin access.

Congratulations! You are now able to access your databases.

Source: https://www.ostraining.com/blog/coding/error-1045-phpmyadmin/

Category: How To

Comments (1)

Zaid Jaber 5 years ago

Thanks this was so helpfull

Read More

How to enable Dark Mode... omg In this article we will be taking a look on how to enable dar...
How to enable Audio des... omg In this article we will take alook on how to eale audio descri...
How to disable GPS loca... omg In this article we will take alook on how to disable the GPS lo...
How to install Signal P... omg In this article we will take alook on how to install signal pri...
How to delete Imo Accou... omg In this article we will take alook on how to delete yout Imo Ac...
How to share your locat... omg In this tutorial we will take a look on how to share your locat...