Mysql管理與配置

orchidllh發表於2005-06-22

管理與配置

通過使用mysqladmin的ping命令可以檢查伺服器是否被啟用。

[lisa@localhost bin]$ mysqladmin -uroot -p ping
Enter password:
mysqld is alive


[lisa@localhost support-files]$ ./mysql.server stop
Shutting down MySQL.[ OK ]
[lisa@localhost support-files]$ mysqladmin -uroot -p ping
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/home/lisa/mysql-max-5.0.6-beta-linux-i686/data/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/home/lisa/mysql-max-5.0.6-beta-linux-i686/data/mysql.sock' exists!

查詢伺服器狀態:
[lisa@localhost bin]$ mysqladmin status -uroot -p
Enter password:
Uptime: 135 Threads: 1 Questions: 2 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 0 Queries per second avg: 0.015

察看伺服器版本:
[lisa@localhost bin]$ mysqladmin version -uroot -p
Enter password:
mysqladmin Ver 8.41 Distrib 4.1.7, for redhat-linux-gnu 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 5.0.6-beta-max
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /home/lisa/mysql-max-5.0.6-beta-linux-i686/data/mysql.sock
Uptime: 2 min 29 sec

Threads: 1 Questions: 3 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 0 Queries per second avg: 0.020

察看擴充套件的狀態資訊:
[lisa@localhost bin]$ mysqladmin extended-status -uroot -p
Enter password:
+-----------------------------------+-----------+
| Variable_name | Value |
+-----------------------------------+-----------+
| Aborted_clients | 0 |
| Aborted_connects | 1 |
| Binlog_cache_disk_use | 0 |
| Binlog_cache_use | 0 |
| Bytes_received | 78 |
| Bytes_sent | 75 |
| Com_admin_commands | 0 |
| Com_alter_db | 0 |


使用set命令:
在伺服器執行時,允許使用set命令修改系統和連線變數。
使用set命令的變數集,根據set關鍵字後面使用的是GLOBAL或者SESSION關鍵字,可以全域性設定在所有會話上,或者只設定在當前會話上。

一旦已經通過set或者通過啟動選項設定,它們的值可以使用show variables命令,或者呼叫帶變數的mysqladmin命令檢索。

mysql> select @@table_type;
+--------------+
| @@table_type |
+--------------+
| MyISAM |
+--------------+
1 row in set (0.00 sec)

mysql> show variables like 'table_type';
+---------------+--------+
| Variable_name | Value |
+---------------+--------+
| table_type | MyISAM |
+---------------+--------+
1 row in set (0.00 sec)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/51862/viewspace-180647/,如需轉載,請註明出處,否則將追究法律責任。

相關文章