很长一段时间以来,我在XAMPP中一直存在这样一个问题:MySQL启动,但在很短时间后就停止了。 因为这个错误,我重新安装了两次XAMPP。 在上次重新安装之后,我终于有了希望,它现在可以工作了。 现在已经工作了大约一个星期,今天又出现了同样的错误。 现在我可以发现MySQL可以通过以管理员权限打开XAMPP并在XAMPP shell中输入命令mysqld--skip-grant-tables
来自动启动。 该命令实际上只停止phpMyAdmin的表。 可能是表中有错误。 然后我为了测试目的将MySQL安装为Windows服务,并且不得不发现MySQL可以在没有问题/命令输入的情况下启动。 但是,如果要调用phpmyadmin,则phpmyadmin上会出现错误消息,MySQL自动停止。 也许有人有解决问题的办法?
phpmyadmin错误消息:
The connection could not be established due to invalid settings.
mysqli :: real_connect (): (HY000 / 2002): A connection could not be established because the target computer refused to connect.
Connection for the control user, as specified in your configuration, has failed.
mysqli :: real_connect (): (HY000 / 2002): A connection could not be established because the target computer refused to connect.
phpMyAdmin tried to connect to the MySQL server and the connection was rejected. You should check your host, user name and password settings in your config.inc.php and make sure that they correspond to the information you received from the administrator.
我想我能找到窃听器。 正如我所怀疑的,很可能是因为一张破桌子。 现在已经再次检查了XAMPP错误日志,并在那里发现了以下错误。
2020-06-30 16:06:09 0 [ERROR] mysqld.exe: Table '. \ Mysql \ db' is marked as crashed and last (automatic?) Repair failed
2020-06-30 16:06:09 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table '. \ Mysql \ db' is marked as crashed and last (automatic?) Repair failed
2020-06-30 16:06:09 0 [ERROR] aborting
意味着你得把桌子修好。 刚刚又检查了一遍。 我想这个帖子可以解决这个问题。