Get the MySQL Server Version

Use MySQL's VERSION() function when you need the server version from SQL. You can also inspect version-related system variables with SHOW VARIABLES.

SELECT VERSION() AS server_version;

Using VERSION()

SELECT VERSION();

The returned string identifies the running database server version. Version details matter when you are checking whether a feature or syntax is supported.

Using SHOW VARIABLES

SHOW VARIABLES LIKE 'version%';

This can return several version-related system variables, not only the main server version.

PHP PDO Example

This example assumes that config.php creates a PDO connection in $dbo.

<?php
require 'config.php';

$stmt = $dbo->query('SELECT VERSION() AS server_version');
$row = $stmt->fetch(PDO::FETCH_ASSOC);

echo 'MySQL version: ' . $row['server_version'];
?>

The PHP sample is static learner-facing HTML, so the variables above are displayed literally and are not interpolated by the host page.




Subscribe to our YouTube Channel here



plus2net.com
tommi

16-03-2009

thanks, it works...




SQL Video Tutorials










✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer