Hi Nixtree,
I am receiving below error while accessing PHPMyAdmin.
#1045 Cannot log in to the MySQL server
How can I fix it ?
PHPMyAdmin Error; #1045 Cannot log in to the MySQL server
Moderator: Staff
cPanel Server Management
@ 30$ Onwards
@ 30$ Onwards
Re: PHPMyAdmin Error; #1045 Cannot log in to the MySQL server
Hello Jackk,
PhpMyAdmin is a free tool which is provide for MYSQL database management. The error you reffered seems to be of some MySQL connectivity issue. Please follow below commands to verify MySQL is up and running fine.
# /etc/init.d/mysqld status
mysqld (pid 23832) is running...
# pidof mysqld
27761
# netstat -plan | grep :3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 23832/mysqld
If you are receiving output as above we van confirm MySQL is up and running.
If you found MySQL to be down, run below command to start the service.
# /etc/init.d/mysqld start
1. Check if you are able to connect to MySQL server using root credentials,
# mysql -u root -p
If you are unable to log into the MySQL prompt then we can conclude that your MySQL root password is not accepted. Try resetting the root password using below command:
# mysqladmin -u root password NEWPASSWORD
replace 'NEWPASSWORD' with the password you want to assign for root user.
Once it is done, check if you are able to access PHPMyAdmin.
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:
$cfg['Servers'][$i]['user'] = 'root'; // enter mysql username here
$cfg['Servers'][$i]['password'] = 'password'; // enter mysql password here
Once it is done, you must be now able to login PhpMyAdmin.
Shaan N
Linux Support Engineer.
Nixtree Solutions
Managed Full Server Backups
https://www.nixtree.com/managed-backups.php
Follow us on : https://twitter.com/nixtree
PhpMyAdmin is a free tool which is provide for MYSQL database management. The error you reffered seems to be of some MySQL connectivity issue. Please follow below commands to verify MySQL is up and running fine.
# /etc/init.d/mysqld status
mysqld (pid 23832) is running...
# pidof mysqld
27761
# netstat -plan | grep :3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 23832/mysqld
If you are receiving output as above we van confirm MySQL is up and running.
If you found MySQL to be down, run below command to start the service.
# /etc/init.d/mysqld start
1. Check if you are able to connect to MySQL server using root credentials,
# mysql -u root -p
If you are unable to log into the MySQL prompt then we can conclude that your MySQL root password is not accepted. Try resetting the root password using below command:
# mysqladmin -u root password NEWPASSWORD
replace 'NEWPASSWORD' with the password you want to assign for root user.
Once it is done, check if you are able to access PHPMyAdmin.
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:
$cfg['Servers'][$i]['user'] = 'root'; // enter mysql username here
$cfg['Servers'][$i]['password'] = 'password'; // enter mysql password here
Once it is done, you must be now able to login PhpMyAdmin.
Shaan N
Linux Support Engineer.
Nixtree Solutions
Managed Full Server Backups
https://www.nixtree.com/managed-backups.php
Follow us on : https://twitter.com/nixtree