Title: Database error for login WordPress site
Last modified: August 19, 2016

---

# Database error for login WordPress site

 *  [marnaux](https://wordpress.org/support/users/marnaux/)
 * (@marnaux)
 * [15 years ago](https://wordpress.org/support/topic/database-error-for-login-wordpress-site/)
 * Hello,
    for one of my WordPress site, since today (yesterday, i had no problem
   to login), it’s impossible to login:
 * “Error establishing a database connection” message for “wp-login” for the site.
 * or
 * “One or more database tables are unavailable. The database may need to be repaired.”
   message for “wp-admin” of the site.
 * I have added then the command “define(‘WP_ALLOW_REPAIR’, true);” in the file 
   indicated by WordPress.
 * Then, i have a screen with 2 buttons (one “Repair Database” and the second “Repair
   and Optimize Database”).
 * When i hit one (or the other) button, it’s immediately displaying a screen with:
 * “Are you sure you want to do this?
 * Please try again.”
 * And when i try to login, the same error described at the beginning of my post
   appears.
 * I have entered in my Hosting CPanel and i checked the database of the site that
   has a problem. All was OK.
 * I have also “repaired” it to see.
 * But always the same error when i try to login to my WordPress site appears.
 * Please, can you help me to solve this problem because i don’t see how to do?
 * Thank you. Marc.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Phil](https://wordpress.org/support/users/owendevelopment/)
 * (@owendevelopment)
 * [15 years ago](https://wordpress.org/support/topic/database-error-for-login-wordpress-site/#post-2052834)
 * I would try repairing the database through PHPMyAdmin (available through your
   cpanel)
 * Follow these [instructions](http://php.about.com/od/mysqladministration/qt/repair_mysql.htm)
 *  Thread Starter [marnaux](https://wordpress.org/support/users/marnaux/)
 * (@marnaux)
 * [15 years ago](https://wordpress.org/support/topic/database-error-for-login-wordpress-site/#post-2052842)
 * Hello,
    thank you for your answer.
 * I forgot to write that i also tried PHPMyAdmin and the instructions provided.
 * All was OK. I have “repaired” it to sse the results.
 * The problem remains the same.
 *  Thread Starter [marnaux](https://wordpress.org/support/users/marnaux/)
 * (@marnaux)
 * [15 years ago](https://wordpress.org/support/topic/database-error-for-login-wordpress-site/#post-2052849)
 * Error
 *  Thread Starter [marnaux](https://wordpress.org/support/users/marnaux/)
 * (@marnaux)
 * [15 years ago](https://wordpress.org/support/topic/database-error-for-login-wordpress-site/#post-2052850)
 * I also tried to change the USER database.
 * I received this message on the screen (i replaced my personnal datas with XXX):
 * ———–
 * 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 XXX database.
 *  * Are you sure it exists?
    * Does the user XXX have permission to use the XXX
   database? * On some systems the name of your database is prefixed with your username,
   so it would be like XXX. Could that be the problem?
 * If you don’t know how to setup a database you should contact your host. If all
   else fails you may find help at the WordPress Support Forums.
 * —————————————
 * As always, the questions in this type of automatic message are completely useless
   to resolve problems.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Database error for login WordPress site’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [marnaux](https://wordpress.org/support/users/marnaux/)
 * Last activity: [15 years ago](https://wordpress.org/support/topic/database-error-for-login-wordpress-site/#post-2052850)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
