使用中のMySQLのバージョンを知りたい場合のコマンド
MySQLはバージョンごとに機能が異なる。
開発時に現在使っているMySQLのバージョンを知っておきたいときがある。
その場合、コマンドラインから知る方法と、MySQLダイアログから確認する方法がある。
1.コマンドラインからバージョンを確認する方法
MySQLのコマンドmysqladminを使う。
$ mysqladmin version mysqladmin Ver 8.40 Distrib 4.0.26, for portbld-freebsd5.4 on i386 Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license Server version 4.0.26 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /tmp/mysql.sock Uptime: 55 min 15 sec
2.MySQLのダイアログから確認する方法
2.1.ダイアログのログイン時
ダイアログに入るとバージョンが表示される。
$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Server version: 5.1.42-community-log MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
5.1.42と確認できる。
2.2.SELECT文で確認
mysql> SElECT VERSION(); +----------------------+ | VERSION() | +----------------------+ | 5.1.42-community-log | +----------------------+ 1 row in set (0.06 sec)
この文でもMySQLのバージョンの確認が可能。