【问题标题】:WAMP WORDPRESS connects to MySQL but will not connect to MariaDBWAMP WORDPRESS 连接到 MySQL 但不会连接到 MariaDB
【发布时间】:2020-02-09 14:03:06
【问题描述】:

Wordpress 无法建立到MariaDB 的连接,只能连接到MySQL 继续获取:Can’t select database 如何设置 Wordpress 连接到MariaDB

禁用或启用 MySQL 也无济于事

这也行不通

这是 PhpMyAdmin 数据库视图

【问题讨论】:

    标签: php mysql wordpress mariadb database-connection


    【解决方案1】:

    搞定了。 我必须将示例配置文件设置为如下所示并将其保存为wp_config.php

     // ** MySQL settings - You can get this info from your web host ** //
        /** The name of the database for WordPress */
        define( 'DB_NAME', 'wp_db' );
    
        /** MySQL database username */
        define( 'DB_USER', 'root' );
    
        /** MySQL database password */
        define( 'DB_PASSWORD', '' );
    
    
    #Here is the MOST IMPORTANT of all
        /** MySQL hostname */
        define( 'DB_HOST', 'localhost:3307' );#IMPORTAT: Notice the :3307 that is the PORT for MariaDB
    
    
        /** Database Charset to use in creating database tables. */
        define( 'DB_CHARSET', 'utf8' );
    
        /** The Database Collate type. Don't change this if in doubt. */
        define( 'DB_COLLATE', '' );
    

    还有,瞧! 不知何故,我花了数天又数小时在谷歌上搜索,到处敲我的头,但解决方案就是这么简单。

    【讨论】:

    • 是的,我有另一种方式(WAMP WORDPRESS 连接到 MariaDB,但不会连接到 MySQL)。在左键 WAMP 菜单中找到 MySQL 的端口,Mysql,蓝线“MySQL 使用的端口”-它是 3308。必须设置 localhost:3308
    猜你喜欢
    • 2015-12-30
    • 2018-03-24
    • 2011-09-24
    • 2020-10-18
    • 1970-01-01
    • 2018-04-24
    • 1970-01-01
    • 1970-01-01
    • 2023-03-06
    相关资源
    最近更新 更多