php8.5
Home/ Manual/ mysql / functions/ mysql_get_server_info

mysql_get_server_info

PHP function Edit on GitHub ✎

(PHP 4 >= 4.0.5, PHP 5)

Get MySQL server info

Note mysqli_get_server_infoPDO::getAttribute with attribute as PDO::ATTR_SERVER_VERSION

Description

mysql_get_server_info(resource $link_identifier = NULL): string|false

Retrieves the MySQL server version.

Parameters

Return Values

Returns the MySQL server version on successFalseforfailure.

Examples

mysql_get_server_info() example

php
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
printf("MySQL server version: %s\n", mysql_get_server_info());
?>

The above example will output something similar to:

output
MySQL server version: 4.0.1-alpha

See Also

Source: reference/mysql/functions/mysql-get-server-info.xml · from the official PHP manual (php/doc-en)