How to repair a WordPress database

Wordpress

WordPress has evolved a lot since its inception in which it served as blogging tool, and today it is a full-fledged CMS, used by all kinds of prestigious sites worldwide as a basis for managing content and publications. But if there is something interesting about this project created by Mat mullenwegg and what saw the light for the first time in 2003 is its high scalability, which allows us to use it equally whether it is a home server or the website of a major company.

But despite its quality, WordPress is not exempt from problems and therefore it can happen that the database suffers some damage, in its entirety or simply some of its tables. In any case, it will be more than enough so that our blog cannot be viewed correctly, since it is in charge of telling the CMS where to look for the texts, images and other content that we see in each post.

An unmistakable symptom of this will be the following message in the log of our WordPress installation: 'WordPress database error Table' ./my_home/wp_posts 'is marked as crashed and last (automatic?) Repair failed for query SELECT post_date_gmt FROM wp_posts WHERE post_status =' publish 'AND post_type IN (' post ',' page ',' attachment ') ORDER BY post_date_gmt DESC LIMIT 1 made by require (' wp-blog-header.php '), wp, WP-> main, WP-> send_headers, get_lastpostmodified, get_lastpostdate, _get_last_post_time'

Let's see then how to fix a corrupted database in our WordPress installation, for which we must enter the Cpanel of our server, which as those who have their own domain hosted in some hosting know well is the section from which we access the configuration of the different parameters and modules that are part of it.

There we must go to the section of Databases -> MySQL Databases, where we should look for the option of 'Repair database', found in the section of 'Modify Databases'. To guide us better, this section is located below the section on 'Create new database', so we must select the database that we are going to repair and then click on the button 'Repair database', after which we will be shown the status of the database of our WordPress installation, and what we should see if everything has gone well is a 'OKAY' next to the name of each table that composes it.

Now maybe instead of him Cpanel let's have root access to server in which the database, which will be the case if we host our own server or if it is located in a University or in a company. This will allow us to work in a way that we law linuxers will be quite used to, and it is from the Command line.

The first step is to stop the server MySQL:

$ sudo service mysql stop

Then we correct the database that shows us problems, which we do through the following command:

$ cd / var / lib /
$ sudo myisamchk -r -v -f mysql / /

Then we simply start the MySQL server again:

$ sudo service mysql start

Both approaches will allow us to solve a problem that in general tends to occur in isolation, although its occurrence is decisive for the correct visualization of our blog or website (or that of the company in which we work) for which in case of happening a solution is required as immediate as possible.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   rafael said

    Hello, I need someone who can help me with a problem I have with my wordpress.
    I have recently changed hosting.
    When I try to put the API key in the plugin I get this.
    Settings error Protocol "https" not supported or disabled in libcurl
    I've talked to the get response guys and they told me I have to change some code, but I don't know how to do it.
    “I just got a response from our DevZone Department.
    You have the following error "Settings error Protocol" https "not supported or disabled in libcurl" (Configuration error: Protocol "https" is not supported or invalid in libcurl:
    https://drive.google.com/file/d/0B1debuNIQoMERENRajZJWDNDUWc/view
    You can read about this error in the link below:
    https://curl.haxx.se/docs/faq.html#Protocol_xxx_not_supported_or_di
    You must configure on your own on your side »

    If you can help me I would appreciate it.