如何解决无法选择数据库Wordpress
我为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');
有什么想法吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。