尝试连接 wordpress 数据库时出现 MYSQL 错误

尝试连接 wordpress 数据库时出现 MYSQL 错误

当我在浏览器中连接到我的 WordPress 网站时,我看到以下内容:

建立数据库连接时出错

当我在终端中检查 MySQL 的状态时,我看到以下内容:

sudo systemctl status mysql

● mysql.service - MySQL Community Server

   Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2022-04-30 11:17:39 IST; 2s ago
  Process: 9424 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)

sr: mysql.service: Control process exited, code=exited status=1
sr: mysql.service: Failed with result 'exit-code'.
sr: Failed to start MySQL Community Server.
sr: mysql.service: Service hold-off time over, scheduling restart.
sr: mysql.service: Scheduled restart job, restart counter is at 5.
sr: Stopped MySQL Community Server.
sr: mysql.service: Start request repeated too quickly.
sr: mysql.service: Failed with result 'exit-code'.
sr: Failed to start MySQL Community Server.

我怎么解决这个问题?

答案1

这是因为在 wp-config.php 中输入了不正确的详细信息

当我在 sudo nano /var/www/html/wp-config.php 中更正数据库用户名时,它现在正常工作

相关内容