在已经安装和配置MySQL的Debian服务器上安装phpmyadmin时,我对一个错误感到非常困惑。我已经尝试清除最新的phpmyadmin失败安装,但我无法安装它。
我还搜索了一些常见的问题,比如试图将phpmyadmin文件修复为https://serverfault.com/questions/341116/setting-up-phpmyadmin-got-a-mysql-syntax-error但是每个CCD_ 1调用在没有值的情况下是正确的(CCD_。
如果有人能帮助我,我将不胜感激!
错误显示:
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>
如果您正在使用或升级到MySQL 8,默认的身份验证插件是caching_sha2_password
编辑/etc/mysql/my.cnf或/etc/mysql.conf.d/mysqld.cnf
在[mysqld]下添加以下行
default-authentication-plugin=mysql_native_password
然后重新启动mysql服务并连接到您的mysql
service mysql restart
mysql -u root -p
然后执行以下命令并将"密码"替换为"根密码">
ALTER USER user IDENTIFIED WITH caching_sha2_password BY 'password';
FLUSH PRIVILEGES;
来源dev.mysql.com
在Digital Ocean上设置服务器时,我确实遇到了这个问题。我需要一个服务器来托管Laravel应用程序。基本上,我必须使用本教程通过安装Nginx来设置我的服务器,然后我使用本教程安装MYSQL版本8.0.22(基本上是最新的可用版本-这通常会导致此错误(,然后我使用本教程安装了PHP7.4,该教程还要求我检查DigitalOcean文章,以使用我用于安装Nginx的相同教程为Nginx配置php处理器。
在这一点上,我想安装phpMyAdmin,但它因同样的错误而失败,我阅读了我在Digital Ocean、Stackoverflow和其他论坛上能找到的每一篇文章,但没有任何解决方案。我发现我可以从官方网站下载phpMyAdmin 5.0.4或更高版本(基本上是最新版本(,因为它与MYSQL 8.0.22版本更兼容。我完全按照本教程手动安装phpMyAdmin,而不是自动安装,而且一切都很完美我可以在浏览器上打开phpMyAdmin,甚至可以使用root和密码登录。我创建了另一个用户,如教程中所示,也可以使用该新用户登录。
真的希望这能帮助有同样问题的人。最后,使用本文来手动安装phpMyAdmin:https://www.digitalocean.com/community/questions/how-to-install-manually-phpmyadmin-on-ubuntu
好的,我通过以下步骤解决了我的问题:
-
完全删除phpmyadmin和mysql:
sudo remove phpmyadmin
+sudo remove mysql
sudo purge phpmyadmin
+sudo purge mysql
( -
升级dist:
sudo apt-get dist-upgrade
-
重新安装所有内容(phpmyadmin+mysql(
-
后来,我在phpmyadmin中遇到了其他与用户和密码有关的问题,但我已经用这个查询解决了这些问题:
mysql -u root mysql
UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root';
timestamp
0
exit;
来源:Can';t将MySQL根密码设置为空