ERROR 1064 (42000) when installing phpMyAdmin

Attempting to install phpMyAdmin 5.1.1 on Ubuntu 18.04 (Bionic Beaver) from the PPA linked below, I received error 1064.

https://launchpad.net/~phpmyadmin/+archive/ubuntu/ppa

An error occurred while installing the database: 
mysql said: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'PASSWORD'' at line 1 . Your options are:

These are the steps I used to complete the install.

  1. When the error is reached, copy the password shown. Then abort the install.
  2. At the console, access mysql:
    sudo mysql -u root -p
  3. Delete the user the installer tried to create
    DROP USER ‘phpmyadmin’@’localhost’;
  4. Create the user (using the same password as the installer), the database and set the permissions
    CREATE USER ‘phpmyadmin’@’localhost’ IDENTIFIED BY ‘PASSWORD’;
    CREATE DATABASE phpmyadmin;
    GRANT ALL PRIVILEGES ON *.* TO ‘phpmyadmin’@’localhost’ WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    exit
  5. Go back and try to reinstall. When the error is reached, choose ignore. This should complete the install.
  6. Access phpMyAdmin web interface and login with username phpmyadmin and the password from step 4.
  7. You will see the error
    The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. Find out why.
    
    Or alternately go to 'Operations' tab of any database to set it up there.
  8. Click on Find out why
  9. At the top, choose the option for: Create missing phpMyAdmin configuration storage tables. 
  10. Once complete, phpMyAdmin should now be working and without any errors.

Note: If you later change the password for the phpmyadmin account, you will start getting the following error message:

mysqli::real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'@'localhost' (using password: YES)
Connection for controluser as defined in your configuration failed.

To clear the error, you will need to update the file below with the same password:
/etc/phpmyadmin/config-db.php

This entry was posted in Uncategorized. Bookmark the permalink.