Current Location: Home> Function Categories> mysql_get_server_info

mysql_get_server_info

Obtain MySQL server information.
Name:mysql_get_server_info
Category:Uncategorized
Programming Language:php
One-line Description:Get the version information of the current MySQL server

Function name: mysql_get_server_info()

Applicable versions: PHP 4, PHP 5, PHP 7

Usage: string mysql_get_server_info ([ resource $link_identifier = NULL ] )

Description: The mysql_get_server_info() function is used to obtain the version information of the current MySQL server.

parameter:

  • $link_identifier (optional): MySQL connection identifier. If this parameter is not provided, the function tries to find the connection that was previously opened by mysql_connect() or mysql_pconnect().

Return value: Returns a string representing the version of the MySQL server.

Example:

  1. Use the default connection to get the MySQL server version information:
 $server_info = mysql_get_server_info(); echo "MySQL 服务器版本:" . $server_info;
  1. Use the specified connection to get the MySQL server version information:
 // 建立MySQL 连接$link = mysql_connect('localhost', 'user', 'password'); if (!$link) { die('连接失败:' . mysql_error()); } // 获取MySQL 服务器版本信息$server_info = mysql_get_server_info($link); echo "MySQL 服务器版本:" . $server_info; // 关闭连接mysql_close($link);

Notes:

  • Since PHP 5.5.0, the mysql_get_server_info() function has been deprecated and is not recommended. Mysqli_get_server_info() or PDO::getAttribute(PDO::ATTR_SERVER_VERSION) should be used instead.
  • Since PHP 7.0.0, the mysql_get_server_info() function has been removed and cannot be used. Mysqli_get_server_info() or PDO::getAttribute(PDO::ATTR_SERVER_VERSION) should be used instead.
Similar Functions
Popular Articles