无法选择数据库Wordpress

时间:2020-08-23 01:14:10

标签: mysql wordpress bitnami amazon-lightsail

我为Wordpress 5.5创建了AWS Lightsail实例。 我的Wordpress备份版本较旧(5.x),因此我决定删除其中的所有文件

/home/bitnami/apps/wordpress/htdocs

上传旧备份中的所有文件。

将所有文件上传到htdocs之后, 我创建了一个新的mysql用户'xxx'和db 'xxx_yyy', 将sql备份上传到数据库'xxx_yyy'。 将'xxx' all privileges授予'xxx_yyy'数据库,并使用此凭据配置wp-config.php

然后我登录

localhost/wp-admin

我得到:

Can’t select database
We were able to connect to the database server (which means your username and password is okay) but not able to select the database.

Are you sure it exists?
Does the user wordpress have permission to use the database?
On some systems the name of your database is prefixed with your username, so it would be like username_. Could that be the problem? 

localhost / adminer.php在上面的凭据下可以正常工作。

wp-config.php

<?php
define('WP_CACHE', true); // Added by WP Rocket

if ( strpos( $_SERVER['REQUEST_URI'], '/register' ) !== false ) {
        define( 'DONOTCACHEPAGE', true );
}



define('DISABLE_WP_CRON', false);

define( 'DN_NAME', 'xxx_yyy');

define( 'DB_USER', 'xxx' );

define( 'DB_PASSWORD', 'password' );

define( 'DB_HOST', 'localhost' );

define('DB_CHARSET', 'utf8');

define('DB_COLLATE', '');

define( 'WP_MEMORY_LIMIT', '256M' ); 

define( 'WP_MAX_MEMORY_LIMIT', '256M' );


define('AUTH_KEY',         'xxxxxxxxxxxxxx');
define('SECURE_AUTH_KEY',  'xxxxxxxxxxxxxx');
define('LOGGED_IN_KEY',    'xxxxxxxxxxxxxx');
define('NONCE_KEY',        'xxxxxxxxxxxxxx');
define('AUTH_SALT',        'xxxxxxxxxxxxxx');
define('SECURE_AUTH_SALT', 'xxxxxxxxxxxxxx');
define('LOGGED_IN_SALT',   'xxxxxxxxxxxxxx');
define('NONCE_SALT',       'xxxxxxxxxxxxxx');


$table_prefix = 'wp_xxxx_';

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'AUTOSAVE_INTERVAL', 300 );
define( 'WP_POST_REVISIONS', 2 );
define( 'EMPTY_TRASH_DAYS', 7 );
define( 'WP_CRON_LOCK_TIMEOUT', 120 );

if ( !defined('ABSPATH') )
        define('ABSPATH', dirname(__FILE__) . '/');

require_once(ABSPATH . 'wp-settings.php');

有什么想法吗?

0 个答案:

没有答案