Support » Fixing WordPress » Warning: mysqli_query(): (HY000/1712): Index term_relationships is corrupted

  • Hey there,
    Recently the WordPress Database of my website was corrupted. There wasn’t any backup of my database so I couldn’t rectify the issue.

    Seems the Table gj_term_relationships got corrupted due to which Menu, Related posts, Category, Tags aren’t working.

    Whenever I add a menu, related posts widget, it shows the following error:

    Warning: mysqli_query(): (HY000/1712): Index gj_term_relationships is corrupted in /home/nschopra22g/examweb.in/wp-includes/wp-db.php on line 1868

    The error is always present on my website [ redundant link removed ] that can be checked through the page source if hidden.

    I am having an average knowledge about WordPress but nothing much about database stuff. I tried emptying the following tables:

    gj_term_relationships

    gj-term_meta

    gj_term_taxonomy

    gj_terms

    The error is still there. Please help me out to sort out this issue. I’m unable to add Menu to my wordpress site due to this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Below I’ve shared the wp-db.php

    /**
    	 * Internal function to perform the mysql_query() call.
    	 *
    	 * @since 3.9.0
    	 *
    	 * @access private
    	 * @see wpdb::query()
    	 *
    	 * @param string $query The query to run.
    	 */
    	private function _do_query( $query ) {
    		if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
    			$this->timer_start();
    		}
    
    		if ( ! empty( $this->dbh ) && $this->use_mysqli ) {
    <strong>/**Line 1868*/</strong> $this->result = mysqli_query( $this->dbh, $query );
    		} elseif ( ! empty( $this->dbh ) ) {
    			$this->result = mysql_query( $query, $this->dbh );
    		}
    		$this->num_queries++;
    
    		if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
    			$this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() );
    		}
    	}

    As I’ve emptied a few tables so there is no more Category, Tags on my site.

    Moderator Steve Stern

    (@sterndata)

    Support Team Volunteer

    OK, you should not have been emptying tables.

    Do you have command line access to your site or access to the DB via phpymadmin?

    In phpmyadmin, go into your database, check *all* the tables and at the bottom, where it says “with selected” choose the “repair” option.

    Hey Steve, Thanks a lot for your input. Actually, I’ve backup of the database so all those deleted tables are safe. I’ve already tried WP Database Repair functionality and PhpMyAdmission Repair Table option.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Warning: mysqli_query(): (HY000/1712): Index term_relationships is corrupted’ is closed to new replies.