[RESOLVED] Error: “1045 cannot log in to the MYSQL server”

Error: “1045 cannot log in to the MYSQL server”.

  1. Bhawani Singh
    PhpMyAdmin is a free tool which is provide for MYSQL database management. With this free software we can manage databases easily like create, delete, drop, import, export and alter. You can also run MYSQL queries in PHPMyAdmin to complete your task. PhpMyAdmin is integrated with cPanel which is provided by your hosting provider.

    Sometimes we are facing some issues in PHPMyAdmin and the error “1045 cannot log in to the MYSQL server” is one of them. So if you are getting this error then what will you do? If you don’t have any idea then let’s see how can we solve this problem?

    How to solve error “1045 cannot log in to the MYSQL server”?

    To solve this error you have to follow some simple steps which are given below...

    1. Check whether the MYSQL is running or not by following command:

    Code:
    # /etc/init.d/mysqld status
    # pidof mysqld
    # netstat -plan | grep :3306
    If you get below output then your MYSQL is running properly. Here is the output:

    Code:
    # /etc/init.d/mysqld status
    mysqld (pid 23832) is running...
    #pidof mysqld
    23832
    # netstat -plan | grep :3306
    tcp  0  0 0.0.0.0:3306  0.0.0.0:*  LISTEN  23832/mysqld
    This code shows that the MYSQL is working perfectly fine, so you don’t have to worry regarding this. You can also restart the MYSQL services with the below line:

    Code:
    #/etc/init.d/mysqld start
    2. If you are still getting the error and not able to login then try to login to command prompt and enter your username and password here. But if don’t remember then you first have to set it in config.inc.php file. Let’s see how to set the PhpMyAdmin password in this file.
    • First check the installation directory of PhpMyAdmin and open config.inc.php file in text editor.
    • Here you have to search for MYSQL username and password field. The code look like below, you just need to enter the MYSQL password to set the login:
    Code:
    $cfg['Servers'][$i]['user'] = 'root'; // enter mysql username here
    $cfg['Servers'][$i]['password'] = 'password'; // enter mysql password here
    • Now try to login into PhpMyAdmin.