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

标签 php mysql wordpress mariadb database-connection

Wordpress 无法与 MariaDB 建立连接,只能连接到 MySQL 不断收到:无法选择数据库 如何设置 WordPress 连接到 MariaDB

enter image description here

禁用或启用 MySQL 都没有帮助

enter image description here

这也不起作用

enter image description here

这是 PhpMyAdmin 数据库 View enter image description here

最佳答案

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

瞧! 不知何故,我花了几天和几个小时在谷歌上搜索并到处敲脑袋,但解决方案就是这么简单。

关于php - WAMP WORDPRESS 连接到 MySQL,但不会连接到 MariaDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58351486/

相关文章:

php - 使用 wordpress $wpdb 在 <table> 中显示数据库中的数据

css - wordpress 标题和容器宽度不会保持在 100%

php - SQL 计算营业时间为早上 10 点到早上 6 点的客户的不同访问次数

java - 如何对具有不同可能性的单个列的记录求和?

php - MYSQL基于CASE查询多个字段

php - 从两个表中选择查询

php - 在 Woocommerce 中获取并显示产品类别特色图像

php - 按类别或作者 wordpress 获取帖子

php - 从数据库中的文本中查找多个单词

从 postmaster@domain.co.uk 收到的 PHP 电子邮件表格