I've just installed phpmyadmin on ubuntu 16.04. When the logo screen shows http://myip/phpmyadmin, and I try to log in it appears: #1045 Cannot log in to the MySQL server. I've tried all posibilities.

Could anyone help me? Thanks


The ** #1045 Cannot log in to the MySQL server** is the results of attempting to login without the proper credentials.

The fact that you are able to get the login screen and attempt to login is an indication that the app Phpmyadmin is properly installed. If there were problems you would see an error on the login screen before trying to login.

The username and password would be something provided by the Administer, or root, which is the default... and the Administrator's credentials.

Answer the login prompt with the root credentials. This is root as the Username and the root's password for the password.

If you don't know the root credentials, and you are the administrator, you would have to change it the password.

You can do this by following the steps provided in this answer:
mysql doesn't ask for root password when installing

The basic steps is to:

  • Stop the mysql server
  • Start the server with the skip-grant-table option
  • Login as root
  • Set a new password
  • Flush the tables
  • Stop the temporary mysql server
  • Restart the server as normal

Then login to the PHPMyadmin server as root and set up the credentials you wish to have for the users.

  • #2002 - Connection refused<br />The server is not responding (or the local server's socket is not correctly configured) – Recharde William Mar 13 '17 at 11:16
  • The original problem PHPMyAdmin login problem was resolved by setting up a mysql login account as provided in the answer. The #2002 error you're getting is a problem with the PHP installation. Those problems would have to be addressed by analyzing more details of the output in the Terminal screen to identify the immediate problem with PHPMyAdmin. – L. D. James Mar 14 '17 at 16:15

This page suggest the following steps in order to install/use php myadmin:

Install PHP MyAdmin

sudo apt-get update
sudo apt-get install phpmyadmin php-mbstring php-gettext

This will ask you a few questions in order to configure your installation correctly.

  • For the server selection, choose apache2.
  • Select yes when asked whether to use dbconfig-common to set up the database You will be prompted for your database administrator's password You will then be asked to choose and confirm a password for the phpMyAdmin application itself

The only thing we need to do is explicitly enable the PHP mcrypt and mbstring extensions, which we can do by typing:

sudo phpenmod mcrypt
sudo phpenmod mbstring

Afterwards, you'll need to restart Apache for your changes to be recognized:

sudo systemctl restart apache2

You can now access the web interface by visiting your server's domain name or public IP address followed by /phpmyadmin:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.