2008年11月16日 星期日

Show the mysql information

# /usr/bin/mysqladmin version
Server version 5.0.45
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 13 sec

Threads: 1 Questions: 1 Slow queries: 0 Opens: 12 Flush tables: 1 Open tables: 6 Queries per second avg: 0.077

PS. Sometimes mysqladmin find the wrong socket (althought that socket is specified in the /etc/my.conf)

In this case we must specify the mysql socket
# mysqladmin -S /var/lib/mysql/mysql.sock version

Or we can modify the config file /etc/my.cnf

/etc/my.cnf is list below
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client] ==> Add this two lines to make all the mysql* client command can read correct path of mysql domain socket file
socket=/var/lib/mysql/mysql.sock


>> Show all the mysql database
# /usr/bin/mysqlshow
+-------------------- +
| Databases |
+-------------------- +
| information_schema |
| mysql |
| test |
+--------------------+

>> Show all the tables of a specified mysql database (mysql)
# mysqlshow mysql

沒有留言: