WordPress 安装时常见的数据库的错误

版权声明:原创文章,转载请注明出处,Crazy Loong(http://goto8848.net)

WordPress 演示版本为 2.2.2,其它版本的显示可能会有细微差别,但总体差别不大。

WordPress 安装环境要求:

  • PHP version 4.2 or greater
  • MySQL version 4.0 or greater
  • 最好有 Rewrite 功能,用来显示永久链接,这个要求是可选的。

数据库问题是新手安装WordPress时经常出现的问题,下面是两种常见的关于数据库的错误。

数据库错误一

当你看见这个页面的,说明的你的数据库可能有以下问题:

  • 你指定的数据库不存在,或者是数据库没有正常工作
  • 你指定的数据库的用户名和密码错误

你需要做的是,确定wp-config.php中,数据库的名称、用户名、地址、数据库服务器地址是否填写正确;确认数据库工作正常。如果你不清楚如何修改wp-config.php,你可以参考 配置文件wp-config.php基础

数据库错误二

如果你看见的是这个页面,那么就是你数据库名称的填写出了问题。你需要做的是检查wp-config.php中,正确填写数据库名称。

50 thoughts on “WordPress 安装时常见的数据库的错误”

  1. 要是出现登陆错误呢。例如:

    Warning: Invalid argument supplied for foreach() in \wordpress\wp-includes\capabilities.php on line 31

    Warning: Cannot modify header information – headers already sent by (output started at \wordpress\wp-includes\capabilities.php:31) in \wordpress\wp-includes\pluggable.php on line 369

    Warning: Cannot modify header information – headers already sent by (output started at \wordpress\wp-includes\capabilities.php:31) in \wordpress\wp-includes\pluggable.php on line 370

    Warning: Cannot modify header information – headers already sent by (output started at \wordpress\wp-includes\capabilities.php:31) in \wordpress\wp-includes\pluggable.php on line 331

  2. ftp软件里都有这个设置,一般在“传送模式”等类似的选项中

  3. 你指定的数据库不存在?

    请问数据库怎么建立?

    整个WordPress 下载包解压后没有 数据库文件的吗?

    与ASP的数据库相差很大吧?

  4. asp使用的最多的是access和mssql的数据库(当然还有其它很多的数据库),mssql和mysql使用方法相近,access则是比较简单的,应该也就是你说的asp数据库了。
    mysql和mssql都需要事先建立好。

  5. 放系wp-db.php的边度啊?可我已经用E文版的装好了。
    现在想变成中文要怎么办?谢啦。

  6. 将mo文件放到wp-content\languages里(没有这个文件夹的话,就建立一个),然后修改wp-config.php中的define (‘WPLANG’, ”);为define (‘WPLANG’, ‘zh_CN’);

  7. 您能帮我看看我这个网址吗?为什么还是数据库链接错误????难道是因为它是php,对服务器空间有特殊要求吗????

  8. 我的网址出现英文界面是这样的:

    Error establishing a database connection
    This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.

    Are you sure you have the correct username and password?
    Are you sure that you have typed the correct hostname?
    Are you sure that the database server is running?
    If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

  9. <?php
    define(‘WP_INSTALLING’, true);

    require_once(‘../wp-includes/compat.php’);
    require_once(‘../wp-includes/functions.php’);

    if (!file_exists(‘../wp-config-sample.php’))
    wp_die(‘Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.’);

    $configFile = file(‘../wp-config-sample.php’);

    if ( !is_writable(‘../’))
    wp_die(“Sorry, I can’t write to the directory. You’ll have to either change the permissions on your WordPress directory or create your wp-config.php manually.”);

    // Check if wp-config.php has been created
    if (file_exists(‘../wp-config.php’))
    wp_die(“The file ‘wp-config.php’ already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try installing now.”);

    if (isset($_GET[‘step’]))
    $step = $_GET[‘step’];
    else
    $step = 0;

    function display_header(){
    header( ‘Content-Type: text/html; charset=utf-8’ );
    ?>

    WordPress › Setup Configuration File

    Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.

    Database name
    Database username
    Database password
    Database host
    Table prefix (if you want to run more than one WordPress in a single database)

    If for any reason this automatic file creation doesn’t work, don’t worry. All this does is fill in the database information to a configuration file. You may also simply open wp-config-sample.php in a text editor, fill in your information, and save it as wp-config.php.
    In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you’re all ready, let’s go!

    Below you should enter your database connection details. If you’re not sure about these, contact your host.

    Database Name

    The name of the database you want to run WP in.

    User Name

    Your MySQL username

    Password

    …and MySQL password.

    Database Host

    99% chance you won’t need to change this value.

    Table Prefix

    If you want to run multiple WordPress installations in a single database, change this.

    $line) {
    switch (substr($line,0,16)) {
    case “define(‘DB_NAME'”:
    fwrite($handle, str_replace(“putyourdbnamehere”, $dbname, $line));
    break;
    case “define(‘DB_USER'”:
    fwrite($handle, str_replace(“‘usernamehere'”, “‘$uname'”, $line));
    break;
    case “define(‘DB_PASSW”:
    fwrite($handle, str_replace(“‘yourpasswordhere'”, “‘$passwrd'”, $line));
    break;
    case “define(‘DB_HOST'”:
    fwrite($handle, str_replace(“localhost”, $dbhost, $line));
    break;
    case ‘$table_prefix =’:
    fwrite($handle, str_replace(‘wp_’, $prefix, $line));
    break;
    default:
    fwrite($handle, $line);
    }
    }
    fclose($handle);
    chmod(‘../wp-config.php’, 0666);

    display_header();
    ?>
    All right sparky! You’ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to run the install!

    WordPress, personal publishing platform.

  10. 关于“你指定的数据库不存在”这句我不明白,难道需要手动新建一个MYSQL的数据库文件吗?要是的话,必须下载MYSQL数据库才能建立吗?

  11. Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 6144 bytes) in E:\wamp\www\iczy\wp-includes\registration.php on line 33
    安装时提示这个,不知道该怎么办了,请帮忙解决下,谢谢

  12. 内存限制了,可以修改php.ini文件的话,你可以将memory_limit这项的值修改大一些;不行的话,你可以尝试修改 wp-config.php 文件,在第一行加入 ini_set(”memory_limit”, “-1″);
    不过,ini_set函数一般都会被禁用,good luck

  13. Warning: Cannot modify header information – headers already sent by (output started at F:\avions_01e1g9vctffhqew9pe8p9tnfjfp300v0\wwwroot\wp-config.php:26) in F:\avions_01e1g9vctffhqew9pe8p9tnfjfp300v0\wwwroot\wp-admin\install.php on line 16

    这个要怎么办?

  14. Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 167141 bytes) in /www/freehoxt.com/y/u/a/yuanv/htdocs/wp-includes/gettext.php on line 161
    安装时提示这个,是不是内存限制的问题?你在19楼说的修改php.ini文件,不知道php.ini在哪,请帮忙解决下,谢谢

  15. To: Yuan.V 内存限制了。如果你是用的虚拟主机的话,你是没有办法直接修改php.ini文件的。如果你是用的虚拟主机,19楼已经告诉你方法了。

  16. 我在安装WordPress的时候总是出现一下这句话:

    PHP has encountered an Access Violation at 01EA73CD

    希望高手解答~~

  17. 这是怎么回事?急等

    WordPress database error: [Access denied for user ‘solon_solon’@’%’ to database ‘solon_yahoo’]
    CREATE TABLE wp_terms ( term_id bigint(20) NOT NULL auto_increment, name varchar(55) NOT NULL default ”, slug varchar(200) NOT NULL default ”, term_group bigint(10) NOT NULL default 0, PRIMARY KEY (term_id), UNIQUE KEY slug (slug) ) DEFAULT CHARACTER SET utf8

    WordPress database error: [Access denied for user ‘solon_solon’@’%’ to database ‘solon_yahoo’]
    CREATE TABLE wp_term_taxonomy ( term_taxonomy_id bigint(20) NOT NULL auto_increment, term_id bigint(20) NOT NULL default 0, taxonomy varchar(32) NOT NULL default ”, description longtext NOT NULL, parent bigint(20) NOT NULL default 0, count bigint(20) NOT NULL default 0, PRIMARY KEY (term_taxonomy_id), UNIQUE KEY term_id_taxonomy (term_id,taxonomy) ) DEFAULT CHARACTER SET utf8

    WordPress database error: [Access denied for user ‘solon_solon’@’%’ to database ‘solon_yahoo’]
    CREATE TABLE wp_term_relationships ( object_id bigint(20) NOT NULL default 0, term_taxonomy_id bigint(20) NOT NULL default 0, term_order int(11) NOT NULL default 0, PRIMARY KEY (object_id,term_taxonomy_id), KEY term_taxonomy_id (term_taxonomy_id) ) DEFAULT CHARACTER SET utf8

    WordPress database error: [Access denied for user ‘solon_solon’@’%’ to database ‘solon_yahoo’]
    CREATE TABLE wp_comments ( comment_ID bigint(20) unsigned NOT NULL auto_increment, comment_post_ID int(11) NOT NULL default ‘0’, comment_author tinytext NOT NULL, comment_author_email varchar(100) NOT NULL default ”, comment_author_url varchar(200) NOT NULL default ”, comment_author_IP varchar(100) NOT NULL default ”, comment_date datetime NOT NULL default ‘0000-00-00 00:00:00’, comment_date_gmt datetime NOT NULL default ‘0000-00-00 00:00:00’, comment_content text NOT NULL, comment_karma int(11) NOT NULL default ‘0’, comment_approved varchar(20) NOT NULL default ‘1’, comment_agent varchar(255) NOT NULL default ”, comment_type varchar(20) NOT NULL default ”, comment_parent bigint(20) NOT NULL default ‘0’, user_id bigint(20) NOT NULL default ‘0’, PRIMARY KEY (comment_ID), KEY comment_approved (comment_approved), KEY comment_post_ID (comment_post_ID), KEY comment_approved_date_gmt (comment_approved,comment_date_gmt), KEY comment_date_gmt (comment_date_gmt) ) DEFAULT CHARACTER SET utf8

    WordPress database error: [Access denied for user ‘solon_solon’@’%’ to database ‘solon_yahoo’]
    CREATE TABLE wp_links ( link_id bigint(20) NOT NULL auto_increment, link_url varchar(255) NOT NULL default ”, link_name varchar(255) NOT NULL default ”, link_image varchar(255) NOT NULL default ”, link_target varchar(25) NOT NULL default ”, link_category bigint(20) NOT NULL default ‘0’, link_description varchar(255) NOT NULL default ”, link_visible varchar(20) NOT NULL default ‘Y’, link_owner int(11) NOT NULL default ‘1’, link_rating int(11) NOT NULL default ‘0’, link_updated datetime NOT NULL default ‘0000-00-00 00:00:00’, link_rel varchar(255) NOT NULL default ”, link_notes mediumtext NOT NULL, link_rss varchar(255) NOT NULL default ”, PRIMARY KEY (link_id), KEY link_category (link_category), KEY link_visible (link_visible) ) DEFAULT CHARACTER SET utf8

    WordPress database error: [Access denied for user ‘solon_solon’@’%’ to database ‘solon_yahoo’]
    CREATE TABLE wp_options ( option_id bigint(20) NOT NULL auto_increment, blog_id int(11) NOT NULL default ‘0’, option_name varchar(64) NOT NULL default ”, option_value longtext NOT NULL, autoload varchar(20) NOT NULL default ‘yes’, PRIMARY KEY (option_id,blog_id,option_name), KEY option_name (option_name) ) DEFAULT CHARACTER SET utf8

    WordPress database error: [Access denied for user ‘solon_solon’@’%’ to database ‘solon_yahoo’]
    CREATE TABLE wp_postmeta ( meta_id bigint(20) NOT NULL auto_increment, post_id bigint(20) NOT NULL default ‘0’, meta_key varchar(255) default NULL, meta_value longtext, PRIMARY KEY (meta_id), KEY post_id (post_id), KEY meta_key (meta_key) ) DEFAULT CHARACTER SET utf8

  18. 还是出现错误,我修改了wp-config.php,数据库地址名称密码都是对的!
    Error establishing a database connection
    This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at mysql38.ixwebhosting.com. This could mean your host’s database server is down.

  19. To: 老电影
    确定你的Mysql服务器是否正常工作,用户名和密码是否正确,用户名是否有权限访问这个数据库。

  20. 感谢斑竹回复,已经解决了上述问题,解决方法是:把我的主机地址直接换成主机IP就可以安装了,但是又出现了新的问题,我按照提示安装成功了,也获取了Username和Password ,但是无法进入管理后台,尝试了——我的域名/wp-admin/”或”我的域名/wp-admin/index.php
    都不能进入管理后台!急,望指点!谢谢

  21. To: 老电影
    不知道你到底是如何不能进入,是密码错误还是一直停留在登录界面,又或者是无法打开页面?

  22. 感谢斑竹回复,是一直停留在安装页面..再次安装就出现超时的错误! 因为安装产生的信息相当多,我把最后一部分信息给您看一下.请您指教!

    WordPress database error: [Table ‘chuweiw_buycegel.wp_posts’ doesn’t exist]
    INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content, post_exceHTTP/1.1 502 Gateway Error Server: Microsoft-IIS/5.0 Date: Thu, 07 Aug 2008 00:18:24 GMT Connection: close Content-Length: 186 Content-Type: text/html

    CGI Timeout
    The specified CGI application exceeded the allowed time for processing. The server has deleted the process.

  23. Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

  24. To: IT技术博客
    如果你的数据库名、用户名、密码和数据库地址都填写正确的话,就绝对是你空间商的问题。

Leave a Reply