Forums

[resolved] How to deactivate MySQL compatibility check? (3 posts)

  1. symbiose
    Member
    Posted 2 years ago #

    How to deactivate MySQL compatibility check?

    Hey, I have a problem with the MySQL compatibility check ... It constantly tells me that I have mysql 4.0 (I actually have 5.0, description follows ...) version and WordPress 2.9.1 needs 4.1.2 or higher ....

    Because my hosting provider offers a kind of hybrid mysql database system, you can switch between 4.0 and 5.0 by demand it tells wordpress some wrong informations about its databases ...

    My question is if it is possible to delete some codes so that WordPress isnt performing the mysql compatibility check ... or can i somehoe deactivate it? Because I am sure my database is 5.0 but just says it wrong ....

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    You'd probably need to change a core file (which is discouraged) to do that.

    Just guessing you would need to look at the function check_database_version in wp-includes/wp-db.php.

  3. symbiose
    Member
    Posted 2 years ago #

    Good advice thanks!

    I changed the following in wp-includes/wp-db.php:

    function check_database_version()
    {
    global $wp_version;
    // Make sure the server has MySQL 4.1.2
    if ( version_compare($this->db_version(), '4.1.2', '<') )
    return new WP_Error('database_version',sprintf(__('ERROR: WordPress %s requires MySQL 4.1.2 or higher'), $wp_version));
    }

    to this:

    function check_database_version()
    {
    global $wp_version;
    // Make sure the server has MySQL 4.1.2
    if ( version_compare($this->db_version(), '2.1.2', '<') )
    return new WP_Error('database_version',sprintf(__('ERROR: WordPress %s requires MySQL 4.1.2 or higher'), $wp_version));
    }

    PLUS

    You have the delete the following code in wp-admin/install.php:

    // Let's check to make sure WP isn't already installed.
    if ( is_blog_installed() ) {display_header(); die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');}
    
    $php_version    = phpversion();
    $mysql_version  = $wpdb->db_version();
    $php_compat     = version_compare( $php_version, $required_php_version, '>=' );
    $mysql_compat   = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
    
    if ( !$mysql_compat && !$php_compat )
    	$compat = sprintf( __('You cannot install because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version );
    elseif ( !$php_compat )
    	$compat = sprintf( __('You cannot install because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version );
    elseif ( !$mysql_compat )
    	$compat = sprintf( __('You cannot install because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version );
    
    if ( !$mysql_compat || !$php_compat ) {
    	display_header();
    	die('<h1>' . __('Insufficient Requirements') . '</h1><p>' . $compat . '</p></body></html>');
    }

Topic Closed

This topic has been closed to new replies.

About this Topic