PHPMyAdmin Error; #1045 Cannot log in to the MySQL server.
PhpMyAdmin is a free and open source tool written in PHP intended to handle the administration of MySQL with the use of a web browser.
It can perform various tasks such as creating, modifying or deleting databases, tables, fields or rows; executing SQL statements; or managing users and permissions.
This article will help you to access databases of cPanel users’ without accessing the cPanel account.
Consider the scenario, you’ve a cPanel account and you want to share the details of a database (DB) with one of your we site developers and actually you do not want to share the cPanel credentials.
This is an error that I received while accessing PHPMyAdmin via cPanel. Please see the error details below:
# 1045 Cannot log in to the MySQL server
1. Check MySQL service is running. You can check this by running the following commands:
# /etc/init.d/mysqld status # pidof mysqld # netstat -plan | grep :3306
# /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
If you are getting the expected output, then try to log in the MySQL prompt by running
# mysql -u root -p
If you are getting the expected output and also you are able to log into the MySQL prompt then we can conclude that your MySQL server is up and running.
If not, then your MySQL service is stopped for any reason.
In that case, you can try running
Even after starting MySQL, if it’s not started then you need to investigate the root cause why the MySQL service is down. For an initial testing, you can check
#df -h #free -m
Also, check the permission of /tmp and see if you can touch a file in /tmp. If all this cases are fine, then you need to check the MySQL logs in the file /var/lib/mysql/hostname.err or you can check in /var/log/mysqld.log .
In this way you can troubleshoot why the MySQL service is down.
If your MySQL server is up and again you are receiving the error as #1045 Cannot log in to the MySQL server then, you can continue reading this.
2. Reset the cPanel password for the user that you are facing this problem. Make sure that “Allow MySQL password change” has been enabled while you are changing the password.