安装过程中phpmyadmin错误1064(42000)

phpmyadmin error 1064 (42000) during installation

在已经安装和配置了 MySQL 的 Debian 服务器上安装 phpmyadmin 时,我对一个错误感到很困惑。我已经尝试清除最新的 phpmyadmin 失败安装,但我无法安装它。

我也已经搜索了常见问题,试图将 phpmyadmin 文件修复为 https://serverfault.com/questions/341116/setting-up-phpmyadmin-got-a-mysql-syntax-error,但每个 timestamp 调用都是正确的,但没有值(timestamp(value) 似乎是错误的)。

如果有人能帮助我,我将不胜感激!

错误说:

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>                               

好的,我通过执行以下步骤解决了我的问题:

  1. 正在完全删除 phpmyadmin 和 mysql:

    sudo remove phpmyadmin + sudo remove mysql

    sudo purge phpmyadmin + sudo purge mysql)

  2. 升级 dist: sudo apt-get dist-upgrade

  3. 正在重新安装所有内容 (phpmyadmin + mysql)

  4. 后来我在 phpmyadmin 中遇到了其他与用户和密码相关的问题,但我已经通过该查询解决了它们:

mysql -u root mysql

UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root';

FLUSH PRIVILEGES;

exit;

Source:

如果您正在使用或升级到 MySQL8,默认的身份验证插件是 caching_sha2_password

编辑/etc/mysql/my.cnf/etc/mysql/mysql.conf.d/mysqld.cnf

[mysqld]

下添加以下行
default-authentication-plugin=mysql_native_password

然后重新启动 mysql 服务并连接到您的 MySQL

service mysql restart 

mysql -u root -p

然后执行以下命令,将'password'替换为'your root password'

ALTER USER user IDENTIFIED WITH caching_sha2_password BY 'password';

FLUSH PRIVILEGES;

来源dev.mysql.com

我在 Digital Ocean 上设置服务器时遇到了这个问题。我需要一台服务器来托管 Laravel 应用程序。基本上我必须通过使用这个 Tutorial, then i installed MYSQL Version 8.0.22 using this Tutorial (basically the latest available version - Which usually leads to this error), then i installed PHP7.4 using this Tutorial of which also required me to check the DigitalOcean article to configure the php processor for Nginx using the same Tutorial 安装 Nginx 来设置我的服务器我曾经安装 Nginx.

此时我想安装 phpMyAdmin,但由于同样的错误而失败,我阅读了在 Digital Ocean、Whosebug 和其他论坛上可以找到的每篇文章,但没有解决方案工作了。我发现我可以从官方网站下载 phpMyAdmin 5.0.4 或更高版本(基本上是最新版本),因为它与 MYSQL 版本 8.0.22。我完全按照这个 Tutorial 手动安装 phpMyAdmin 而不是自动安装并且 一切正常! 我能够打开 phpMyAdmin浏览器,甚至能够使用 root 和密码登录。我按照教程中的指示创建了另一个用户,并且还能够使用该新用户登录。

真心希望这对遇到同样问题的人有所帮助。最后,使用本文手动安装 phpMyAdminhttps://www.digitalocean.com/community/questions/how-to-install-manually-phpmyadmin-on-ubuntu