代码之家  ›  专栏  ›  技术社区  ›  Simeon Leyzerzon mthmulders

在CyberPanel中的WordPress站点上建立数据库连接时出错

  •  0
  • Simeon Leyzerzon mthmulders  · 技术社区  · 5 年前

    我突然开始得到一个 'Error establishing a database connection' 我的WooCommerce网站在Centos 8下托管在CyberPanel上。

    为了理解发生了什么,我在wp_config php中添加了以下内容:

    define('WP_ALLOW_REPAIR', true);
    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true);
    

    这揭示了以下堆栈跟踪:

    ( ! ) Warning: mysqli_real_connect(): (HY000/1045): Access denied for user 'w8WI11xxxxGCO'@'localhost' (using password: YES) in /home/example.com/public_html/wp-includes/wp-db.php on line 1653
    Call Stack
    # Time Memory Function Location
    1 0.0009 372512 {main}( ) .../repair.php:0
    2 0.0012 373000 require_once( '/home/example.com/public_html/wp-load.php' ) .../repair.php:10
    3 0.0015 373400 require_once( '/home/example.com/public_html/wp-config.php' ) .../wp-load.php:37
    4 0.0025 374800 require_once( '/home/example.com/public_html/wp-settings.php' ) .../wp-config.php:84
    5 0.0546 832240 require_wp_db( ) .../wp-settings.php:124
    6 0.0610 836424 wpdb->__construct( ) .../load.php:527
    7 0.0610 836424 wpdb->db_connect( ) .../wp-db.php:632
    8 0.0611 838000 mysqli_real_connect ( ) .../wp-db.php:1653
    Access denied for user 'w8WI11xxxxxGCO'@'localhost' (using password: YES)
    
    Error establishing a database connection
    

    我似乎可以通过CyberPanel通过phpMyAdmin UI访问数据库,在那里我可以看到,在似乎与我的WordPress应用程序(w8WI11xxxxGCO)相关的数据库中,有一个在以下URL更改密码的选项: https://example.com:8090/phpmyadmin/server_privileges.php?username=w8WI11xxxxGCO&hostname=<myIP> .

    我试图将密码更改为 wp_config.php .

    重新启动Lightspeed服务器并重试后,错误行为仍然存在。

    我怎样才能从中恢复过来?

    为什么当数据库可以通过phpMyAdmin完全访问时,应用程序不会启动?

    如果有人能指导我解决这个问题,我将不胜感激。

    提前感谢。

    附言:我还尝试将此用户配置为没有密码并授予他所有权限,但这也不会改变情况,除了现在显示的错误消息如下:

    Warning: mysqli_real_connect(): (HY000/1045): Access denied for user 'w8WI11xxxxxGCO'@'localhost' (using password: NO) in /home/example.com/public_html/wp-includes/wp-db.php on line 1653
    

    然后,我决定从命令行对数据库运行以下脚本:

    这证实了CyberPanel中的某些东西不知怎么搞砸了凭据:

    PHP Warning:  mysqli_connect(): (HY000/1045): Access denied for user 'w8WI11xxxxxGCO'@'localhost' (using password: YES) in /home/example
    .com/public_html/testConnection.php on line 2                                                                                             
    PHP Stack trace:                                                                                                                           
    PHP   1. {main}() /home/example.com/public_html/testConnection.php:0                                                                   
    PHP   2. mysqli_connect() /home/example.com/public_html/testConnection.php:2                                                           
    PHP Warning:  mysqli_error() expects exactly 1 parameter, 0 given in /home/example.com/public_html/testConnection.php on line 4        
    PHP Stack trace:                                                                                                                           
    PHP   1. {main}() /home/example.com/public_html/testConnection.php:0                                                                   
    PHP   2. mysqli_error() /home/example.com/public_html/testConnection.php:4                                                             
    Could not connect: [root@example ~]# 
    

    我很想知道CyberPanel中的什么会以破坏DB凭据的方式扰乱配置,并且不允许恢复它们。

    也许有人(希望代表CyberPanel团队或对其有足够的了解)可以在这里为我介绍他们的产品。

    0 回复  |  直到 5 年前