Retrieves full MySQL server information.

Return Return

(string|false) Server info on success, false on failure.

Top ↑

Source Source

File: wp-includes/wp-db.php

	public function db_server_info() {
		if ( $this->use_mysqli ) {
			$server_info = mysqli_get_server_info( $this->dbh );
		} else {
			$server_info = mysql_get_server_info( $this->dbh );

		return $server_info;

Top ↑

Changelog Changelog

Version Description
5.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 2 content
    Contributed by Liton Arefin

    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

Top ↑

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