WAMP WORDPRESS连接到MySQL,但不会连接到MariaDB

时间:2019-10-12 06:27:14

标签: php mysql wordpress mariadb database-connection

WordPress无法建立与MariaDB的连接,而只能与MySQL连接 持续获取:Can’t select database 如何将Wordpress设置为连接到MariaDB

enter image description here

禁用或启用MySQL均无济于事

enter image description here

这也不起作用

enter image description here

这是PhpMyAdmin数据库视图 enter image description here

1 个答案:

答案 0 :(得分:0)

使其正常工作。 我必须将示例配置文件设置为如下所示,并将其另存为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', '' );

瞧! 不知何故,我花了数天和数小时的时间在Google上搜寻,并在各处猛击头,但解决方案是如此简单。