WP_CLI\Utils
get_mysql_version()
Get the version of the MySQL database.
No Hooks.
Return
String
. Version of the MySQL database, or an empty string if not found.
Usage
get_mysql_version();
get_mysql_version() get mysql version code WP-CLI 2.8.0-alpha
function get_mysql_version() { static $version = null; if ( null === $version ) { $result = Process::create( '/usr/bin/env mysql --version', null, null )->run(); if ( 0 !== $result->return_code ) { $version = ''; } else { $version = trim( $result->stdout ); } } return $version; }