WordPress.org

Codex

User:harkey/Database Errors

EDIT ME!

This article is a ROUGH DRAFT. The author is still working on this document, so please do not edit this without the author's permission. The content within this article may not yet be verified or valid. This information is subject to change.

The following are some of the common errors occasionally found when installing or modifying WordPress. Familiarity with phpMyAdmin, MySQL, and PHP maybe required to resolve some of these errors. For more help on resolving errors, see the resource list below.

Contents

Installation Errors

If you are still having problems, then consult Installing WordPress or FAQ Installation

Database Connection Errors

The following errors are most commonly found in relationship to changes within the database during an installation or with the addition of a new or updated plugin. When possible, track backwards from what you have done to fix the error. If it is a plugin, delete the plugin from the server and see if this fixes the problem.

Can't Select Database

This is a result of a missing database or an attempt to connect to a database that does not exist. You can modify the database you are attempting to connect to through the wp-config.php file. Add a user prefix to the database if you are having difficulties.

EXPLAIN WHAT ADD USER PREFIX MEANS

Connection Could Not Be Established

There are numerous reasons that may prevent you from connecting to your database.

  1. The database may not exist. If you are unsure, then you may need to ask your Web Host for information on your MySQL database.
  2. Your configuration file may have erroneous information. This is the most common mistake when configuring Wordpress.
  3. You may be missing a necessary user prefix. If so in the wp-config.php file modify the "DB_NAME" constant to "yourloginname_wp", or modify "DB_USER" with "yourloginname_dbuser".

Check that there is no whitespace at the bottom of your wp-config.php file.

Also, check your Wordpress configuration values have been set correctly. When the username or password assigned to the WordPress Database contains non alpha-numeric characters, the code may become corrupted. To prevent this problem make the following changes to your wp-config.php file:

// ** MySQL settings ** //
define('DB_NAME', 'user_wp');     // The name of the database
define('DB_USER', 'user');     // Your MySQL username
define('DB_PASSWORD', 'password'); // ...and password
define('DB_HOST', 'localhost');

Modified(wp-config.php):

// ** MySQL settings ** //
define("DB_NAME", "user_wp");     // The name of the database
define("DB_USER", "user");     // Your MySQL username
define("DB_PASSWORD", "password"); // ...and password
define("DB_HOST", "localhost"); 

Notice the modified version has replaced all single quotes with double quotes. This allows for non alpha-numeric characters to be used without creating a connection error.

Plugin Errors

Plugin errors can come from many sources. Sometimes from a problem within the plugin itself or from a conflict with other plugins. Some plugins are compatible with only certain versions of WordPress. Most plugin errors are resolved by removing or disabling the plugin.

EXPLAIN HOW TO REMOVE AND DISABLE A PLUGIN - See WordPress Housekeeping and Solving Plugin Problems for specifics or at least a nice sentence that links to the specific references for more information

Missing Headers

This happens ALL the time - I'm not sure it's a database error or not.

Missing Tables

When plugins create tables, they don't always work and the plugin borks looking for a non-existent table. Need info on this.

SQL Query Consuming Database Resources

This problem is most often encountered with "latest comment" plugins and some archive plugins. The best solution is to remove or deactivate the plugin and contact the plugin author for an update.

Specific Errors

There are a few specific errors that occur in relationship with the WordPress database.

Cannot Create/Write to File...

This may be a sign of several problems, usually related to access to the files on your server, file permissions, or corrupted files. Begin by checking to see if the file is still viable and replace it with the original or updated version. Then see Changing File Permissions on how to change the permissions on files to make them writable or changeable. If these fail, contact your web host in order to resolve this issue.

CREATE Command Denied to User

This error result when the user assigned to this database does not having sufficient permissions to perform actions to create columns or tables in the database. If you have access to phpMyAdmin, set the permissions to allow creation of columns or tables. If you do not or this doesn't work, contact your web host to adjust the setting.

It may be necessary to create a new user with overall permission to resolve the issue. If you do so, modify your wp-config.php file with the new username and password, if necessary.

Error 28 From Table Handler

This error may occur when the cache on your server is full. Your web host needs to be contatcted immediately to empty the cache.

When switching servers, this error may also occur. This error has been known to self-resolve. For more information, see Error 28 For More Information. FIND THIS

Error 145

If a table in your database is damagned, you will need to access phpMyAdmin and run a CHECK and REPAIR on the tables/database in which the errors are found.

Parse Error

The error is a result of ____________ and is usually not not associated with your database. For more information on these errors, see................

Unknown Column

An Unknown Column error is the result of a missing column in the database. The data is prevented from being retrieved or stored in this column. If you have recently upgraded WordPress, then try running wp-admin/upgrade.php again to create the missing column.

Additional problems may occur, if this is the case, then reinsert a fresh copy of the database structure via phpMyAdmin. WHAT??? And HOW???? - Does this happen more with installs or generally? If installs, move it there.

Resources

The following may help you resolve these and other errors you may encounter.