Let us understand how to check the version of MySQL that the user is currently running −
Before entering queries on the console, it is important to ensure that the user is connected to the server.
The below query would give the version number of the server being used, and the current date.
mysql> SELECT VERSION(), CURRENT_DATE;
Note: The function ‘VERSION()’ and ‘CURRENT_DATE’ are case −insensitive. This means ‘version()’, ‘Version()’, ‘vERsion()’, all mean the same. Same goes with ‘CURRENT_DATE’
Learn about MySQL Queries
An SQL query is followed by a semi−colon.
When a query is issued to mysql, it sends the query to the server for execution. The results are computed and displayed. Another ‘mysql>’ also gets printed, indicating that the server is ready for one more query.
The output after executing the mysql query is in tabular form, i.e rows and columns. The first row contains the name of the columns. The remaining rows are the query results.
Once the query is executed, ‘mysql’ also gives the number of rows that were returned, the amount of time taken to execute the query. This gives the user a rough idea about the performance of the server.
MySQL server can also be used to execute multiple statement in a single line. It has been shown below −
mysql > SELECT VERSION(); SELECT NOW();