PHPMyAdmin Error; #1045 Cannot log in to the MySQL server

Discussions related with hosting control panels used, which include cPanel, Plesk, Directadmin etc..

Moderator: Staff

Post Reply
Jackk
Posts: 0
Joined: Fri Apr 13, 2018 7:18 pm

PHPMyAdmin Error; #1045 Cannot log in to the MySQL server

Post by Jackk »

Hi Nixtree,

I am receiving below error while accessing PHPMyAdmin.

#1045 Cannot log in to the MySQL server

How can I fix it ?


shaan
Posts: 0
Joined: Sat Apr 14, 2018 4:21 pm

Re: PHPMyAdmin Error; #1045 Cannot log in to the MySQL server

Post by shaan »

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


Jackk
Posts: 0
Joined: Fri Apr 13, 2018 7:18 pm

Re: PHPMyAdmin Error; #1045 Cannot log in to the MySQL server

Post by Jackk »

Hi Shaan,

Thanks for the great fix.


If you are looking for assistance in server management, please get in touch with our support.
Post Reply