How To Find Version Of MySQL in PHP?
Usually in command line we find in this way.
mysql -V
If we want to do in PHP you can do this with PDO in this way.
$db = new PDO('mysql:host=localhost', 'username', 'pass');
$version = $db->query('SHOW VARIABLES LIKE \'version\'')->fetch(PDO::FETCH_ASSOC);
echo $version['Value']; // Result: 5.7.10
If you noticed that when I making connections I did not connect any database because to learn the version you do not need to connect any database
Comments
Popular Articles
Popular Tags
- #directive
- #Function
- #React
- #Class
- #centOS
- #Json
- #Text
- #API
- #URL
- #Encrypting
- #Redirect
- #Form
- #Special Characters
- #Special
- #Random
- #Generating
- #SASS
- #Version
- #Installation
- #Show
- #
- #Ajax
- #method
- #Logic For Displaying Posts
- #Key
- #DDOS
- #Default Value
- #Comment Line
- #1364 Field
- #Error
- #Abbreviation
- #QR Code Generating
- #Date
- #timeAgo
- #cURL
- #Array
- #Arrays with Key Values to String Statement
- #Short Tag
- #Vite
- #Reading Excel Files
- #Activate
- #Reading
- #Composer
- #Autoloader
- #PSR-4
- #Insert
- #Record
- #Real Time
- #Characters
- #Socket.io
There are no comments, make the firs comment