Search code examples
mysqldatabasephpmyadmininstallationfailed-installation

phpmyadmin error 1064 (42000) during installation


I'm quite confused about an error while installing phpmyadmin on a Debian server with MySQL already installed and configured. I've already tried to purge the latest phpmyadmin failed installations, but I'm not being able to installing it.

I've also already searched for common questions as trying to fix phpmyadmin files as https://serverfault.com/questions/341116/setting-up-phpmyadmin-got-a-mysql-syntax-error but every timestamp call is correct without values ( timestamp(value) seems to be wrong).

If anyone could help me I'd be so grateful!

The error says:

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                             
 │ 'hereismypassword'' at line 1 . Your options are:               
 │  * abort - Causes the operation to fail; you will need to downgrade,        
 │    reinstall, reconfigure this package, or otherwise manually intervene     
 │    to continue using it. This will usually also impact your ability to      
 │    install other packages until the installation failure is resolved.       
 │  * retry - Prompts once more with all the configuration questions           
 │    (including ones you may have missed due to the debconf priority          
 │    setting) and makes another attempt at performing the operation.          
 │  * retry (skip questions) - Immediately attempts the operation again,       
 │                                                                             
 │                                  <Ok>                               

Solution

  • if you are using or upgrading to MySQL 8, the default Authentication Plugin is caching_sha2_password

    Edit /etc/mysql/my.cnf or /etc/mysql/mysql.conf.d/mysqld.cnf

    Add the following line under [mysqld]

    default-authentication-plugin=mysql_native_password
    

    Then restart mysql service and connect to your MySQL

    service mysql restart 
    
    mysql -u root -p
    

    Then execute the following commands and replace 'password' with 'your root password'

    ALTER USER user IDENTIFIED WITH caching_sha2_password BY 'password';
    
    FLUSH PRIVILEGES;
    

    Source dev.mysql.com