MYSQL 稼動状態確認 (ローカル、リモート)
[root@colinux ~]# mysqladmin ping -h localhost -u root -p
Enter password:
mysqld is alive
[root@colinux ~]#
MYSQLサービス状態の確認
[root@colinux ~]# mysqladmin status -u root -ppassword
Uptime: 12793 Threads: 1 Questions: 77 Slow queries: 0 Opens: 18 Flush tabl
es: 1 Open tables: 4 Queries per second avg: 0.6
[root@colinux ~]#
MYSQLバージョン確認
[root@colinux bin]# mysqladmin version -u root -ppassword
mysqladmin Ver 8.42 Distrib 5.1.30, for pc-linux-gnu on i686
Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
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 5.1.30
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 14 min 12 sec
Threads: 1 Questions: 12406 Slow queries: 0 Opens: 472 Flush tables: 2 Open
tables: 3 Queries per second avg: 14.561
[root@colinux bin]#
GRANTテーブルをリロード
[root@colinux bin]# mysqladmin flush-privileges -u root -ppassword
[root@colinux bin]#
————————————————————————————————–
————————————————————————————————–
create databasename Create a new database
debug Instruct server to write debug information to log
drop databasename Delete a database and all its tables
extended-status Gives an extended status message from the server
flush-hosts Flush all cached hosts
flush-logs Flush all logs
flush-status Clear status variables
flush-tables Flush all tables
flush-threads Flush the thread cache
flush-privileges Reload grant tables (same as reload)
kill id,id,… Kill mysql threads
ping Check if mysqld is alive
processlist Show list of active threads in server
reload Reload grant tables
refresh Flush all tables and close and open logfiles
shutdown Take server down
status Gives a short status message from the server
start-slave Start slave
stop-slave Stop slave
variables Prints variables available
version Get version info from server
※ [root@colinux ~]# mysqladmin shutdown -u root -ppassword
mysqladminでローカルリモートサーバーのshutdownが可能。startオプション無し。
mysqlコマンドでは出来ません。
■ping Check if mysqld is alive
[root@localhost ~]$ mysqladmin ping -h localhost -u root -p
Enter password:
mysqld is alive
[root@localhost ~]$
■processlist Show list of active threads in server
[root@localhost ~]$ mysqladmin processlist -h localhost -u root -p
Enter password:
+——+——+—————–+—-+———+——+——-+——————+
| Id | User | Host | db | Command | Time | State | Info |
+——+——+—————–+—-+———+——+——-+——————+
| 3638 | root | localhost:37293 | | Query | 0 | | show processlist |
+——+——+—————–+—-+———+——+——-+——————+
[root@localhost ~]$
■reload Reload grant tables
[root@localhost ~]$ mysqladmin reload -h localhost -u root -p
Enter password:
[root@localhost ~]$
■refresh Flush all tables and close and open logfiles
[root@localhost ~]$ mysqladmin refresh -h localhost -u root -p
Enter password:
[root@localhost ~]$
■shutdown Take server down
[root@localhost ~]$ mysqladmin shutdown -h localhost -u root -p
Enter password:
[root@localhost ~]$
※注意 Startは出来ません。
■status Gives a short status message from the server
[root@localhost ~]$ mysqladmin status -h localhost -u root -p
Enter password:
Uptime: 90 Threads: 1 Questions: 1 Slow queries: 0 Opens: 15 Flush tables: 1 Open tables: 8 Queries per second avg: 0.11
[root@localhost ~]$
■start-slave Start slave
■stop-slave Stop slave
■variables Prints variables available
[root@localhost ~]$ mysqladmin variables -h localhost -u root -p
Enter password:
+———————————+———————————————————————–+
| Variable_name | Value |
+———————————+———————————————————————–+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
| autocommit | ON |
| automatic_sp_privileges | ON |
| back_log | 50 |
| basedir | /usr/local/src/mysql-5.1.25-rc-linux-i686-icc-glibc23/ |
| big_tables | OFF |
| binlog_cache_size | 32768 |
| binlog_format | MIXED |
| bulk_insert_buffer_size | 8388608 |
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
■version Get version info from server
[root@localhost ~]$ mysqladmin version -h localhost -u root -p
Enter password:
mysqladmin Ver 8.42 Distrib 5.1.25-rc, for redhat-linux-gnu on i686
Copyright (C) 2000-2006 MySQL 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 5.1.25-rc-log
Protocol version 10
Connection localhost via TCP/IP
TCP port 3306
Uptime: 3 min 19 sec
Threads: 1 Questions: 4 Slow queries: 0 Opens: 15 Flush tables: 1 Open tables: 8 Queries per second avg: 0.20
[root@localhost ~]$