[root@Betty mysql_client_test]# ll 總計 116 -rw-r--r-- 1 root root 4130 10-25 14:33 client_priv.h -rw-r--r-- 1 root root 2124 10-25 15:01 my_default.h -rw-r--r-- 1 7161 wheel 25393 10-25 15:03 mysqlshow.c -rw-r--r-- 1 root root 1686 10-25 15:01 welcome_copyright_notice.h [root@Betty mysql_client_test]#
成功編譯 html
[root@Betty mysql_client_test]# gcc mysqlshow.c -o mysqlshow `mysql_config --cflags` `mysql_config --libs` -DDBUG_OFF [root@Betty mysql_client_test]# ll 總計 116 -rw-r--r-- 1 root root 4130 10-25 14:33 client_priv.h -rw-r--r-- 1 root root 2124 10-25 15:01 my_default.h -rwxr-xr-x 1 root root 66953 10-25 16:23 mysqlshow -rw-r--r-- 1 7161 wheel 25393 10-25 15:03 mysqlshow.c -rw-r--r-- 1 root root 1686 10-25 15:01 welcome_copyright_notice.h [root@Betty mysql_client_test]#
執行 mysql
[root@Betty mysql_client_test]# ./mysqlshow --help ./mysqlshow Ver 9.10 Distrib 5.6.10, for Linux (x86_64) Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Shows the structure of a MySQL database (databases, tables, and columns). Usage: ./mysqlshow [OPTIONS] [database [table [column]]] If last argument contains a shell or SQL wildcard (*,?,% or _) then only what's matched by the wildcard is shown. If no database is given then all matching databases are shown. If no table is given, then all matching tables in database are shown. If no column is given, then all matching columns and column types in table are shown. Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf The following groups are read: mysqlshow client The following options may be given as the first argument: --print-defaults Print the program argument list and exit. --no-defaults Don't read default options from any option file, except for login file. --defaults-file=# Only read default options from the given file #. --defaults-extra-file=# Read this file after the global files are read. --defaults-group-suffix=# Also read groups with concat(group, suffix) --login-path=# Read this path from the login file. --bind-address=name IP address to bind to. -c, --character-sets-dir=name Directory for character set files. --default-character-set=name Set the default character set. --count Show number of rows per table (may be slow for non-MyISAM tables). -C, --compress Use compression in server/client protocol. -#, --debug[=name] Output debug log. Often this is 'd:t:o,filename'. --debug-check Check memory and open file usage at exit. --debug-info Print some debug info at exit. --default-auth=name Default authentication client-side plugin to use. -?, --help Display this help and exit. -h, --host=name Connect to host. -i, --status Shows a lot of extra information about each table. -k, --keys Show keys for table. -p, --password[=name] Password to use when connecting to server. If password is not given, it's solicited on the tty. --plugin-dir=name Directory for client-side plugins. -P, --port=# Port number to use for connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306). --protocol=name The protocol to use for connection (tcp, socket, pipe, memory). -t, --show-table-type Show table type column. -S, --socket=name The socket file to use for connection. -u, --user=name User for login if not current user. -v, --verbose More verbose output; you can use this multiple times to get even more verbose output. -V, --version Output version information and exit. Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) --------------------------------- ---------------------------------------- bind-address (No default value) character-sets-dir (No default value) default-character-set auto count FALSE compress FALSE debug-check FALSE debug-info FALSE default-auth (No default value) host (No default value) status FALSE keys FALSE plugin-dir (No default value) port 0 show-table-type FALSE socket (No default value) user (No default value) [root@Betty mysql_client_test]#
確實和源碼編譯 MySQL 獲得的 mysqlshow 一致,到此暫時走出了研究 MySQL 客戶端實現的第一步。能夠稍微總結一下了: sql