wpdb::db_server_info(): string

Returns the version of the MySQL server.

Return

string Server version as a string.

Source

public function db_server_info() {
	return mysqli_get_server_info( $this->dbh );
}

Changelog

VersionDescription
5.5.0Introduced.

User Contributed Notes

  1. Skip to note 4 content

    Another way to Retrieve MySQL Server version by using $wpdb:

    global $wpdb;
    $db_version_dump = $wpdb->get_var( 'SELECT VERSION() AS version from DUAL' );
    if ( preg_match( '/\d+(?:\.\d+)+/', $db_version_dump, $matches ) ) {
        echo $matches[0]; //returning the first match of Database Version
    }

You must log in before being able to contribute a note or feedback.