Share on Google+Share on Google+

PHP MySql Server Version

PHP MySql Server Version tutorial provides an example through which you can get the MySql server version.

PHP MYSQL server version

Sometimes we need to check the version of MySql, PHP provides mysql_get_server_info() function to check the MySql version.

To check the version of MySql we need to know username (such as: root) and password (whatever you have set during the installation process.)

If you are interested to know in detail about the die construct please visit our web page:



$link = mysql_connect('localhost', 'root',  ' zz ' );//mysql_connect(): it open a connection to a MySql server

//root is the name of user and password is zz, replace these values with your MySql's username & respective password

if (!$link) {

die('Could not connect: ' . mysql_error());//mysql_error() function returns the text of the error message

// die construct is equivalent to exit()


printf("MySQL server version: %s\n", mysql_get_server_info());//mysql_get_server_info() is used to get MySql server information



MySQL server version: 5.0.19-nt


Posted on: October 10, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null