首页 > Linux操作系统 > Linux操作系统 > Mysql管理与配置
管理与配置
通过使用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博客 ” ,链接:https://blog.itpub.net/51862/viewspace-180647/ ,如需转载,请注明出处,否则将追究法律责任。