--help
mysql
LOAD DATA
INFILE
InnoDB
MyISAM
MyISAM
MyISAM
MyISAM
.mylogin.cnf
MYSQL_UNIX_PORT | localhost |
MYSQL_TCP_PORT | |
MYSQL_PWD | |
MYSQL_DEBUG | |
TMPDIR |
MYSQL_PWD
shell>%C:\>
shell>mysql --user=root testshell>mysqladmin extended-status variablesshell>mysqlshow --helpshell>mysqldump -u root personnel
-
mysql
--user=root test
--host--user--password--port--socket
binbinPATH/usr/local/mysql/bin
PATHPATH
shell> mysql
localhost
ODBC
-p--password
shell>mysql --host=localhost --user=myname --password=shell>passwordmydbmysql -h localhost -u myname -ppasswordmydb
-p--password-p--password=
-p--password
--password
shell>mysql --host=localhost --user=myname --password mydbshell>mysql -h localhost -u myname -p mydb
mydb
localhost--port--host127.0.0.1--protocol=TCP
内核> mysql --host=127.0.0.1内核> mysql --protocol=TCP
--protocol
--host=::1
--pipe--protocol=PIPE--socket
remote.example.com
内核> mysql --host=remote.example.com
--port
shell> mysql --host=remote.example.com --port=13306
localhost
--port
内核> mysql --port=13306 --host=localhost
shell>mysql --port=13306 --host=127.0.0.1shell>mysql --port=13306 --protocol=TCP
--host=host_namehost_name
localhost
--password[=pass_val]pass_val
-p--password=
--pipe
--enable-named-pipe
--port=port_numport_num
--protocol={TCP|SOCKET|PIPE|MEMORY}
localhost
内核> mysql --host=localhost
--protocol
内核> mysql --host=localhost --protocol=TCP
--protocol
--protocol | ||
|---|---|---|
TCP | ||
SOCKET | ||
PIPE | ||
MEMORY |
--shared-memory-base-name=name
MYSQL
--shared-memory
--socket=file_namefile_name
/tmp/mysql.sock
MySQL
--enable-named-pipe
--ssl
--user=user_nameuser_name
ODBC
[client]
[client]host=host_nameuser=user_namepassword=your_pass
MYSQL_HOSTMYSQL_PWD
localhost
内核> mysql -h example.com -h localhost
shell> mysql --column-names --skip-column-names
-?
-v--verbose
-h localhost--host=localhost
=-h localhost--password=pass_val--passwordpass_val
shell>mysql -ptestshell>mysql -p test
testtest
---skip-grant-tables--skip_grant_tables
KGTE
shell> mysqladmin --count=1K --sleep=10 ping
~
--execute
shell>mysql -u root -p --execute="SELECT User, Host FROM mysql.user"Enter password:******+------+-----------+ | User | Host | +------+-----------+ | | gigan | | root | gigan | | | localhost | | jon | localhost | | root | localhost | +------+-----------+ shell>
--execute=
shell>mysql -u root -p -e "SELECT VERSION();SELECT NOW()"Enter password:******+---------------------+ | VERSION() | +---------------------+ | 5.8.0-m17-debug-log | +---------------------+ +---------------------+ | NOW() | +---------------------+ | 2015-11-05 20:00:20 | +---------------------+
--column-names
--disable-column-names --skip-column-names --column-names=0
--disable=0
--column-names --enable-column-names --column-names=1
ONOFF
--loose
内核> mysql --loose-no-such-optionMySQL:警告:未知选项--松没有这样的选择”
--looseloose
--maximum--maximum--maximum-max_heap_table_size=32M
--maximum--maximum-back_log=200
Maximum value of 'back_log' cannot be set
--help--verbose--help
--no-defaults
persisted_globals_load
.mylogin.cnfhostpasswordsocket--login-path
MYSQL_TEST_LOGIN_FILE
mysqld-auto.cnfSET
PERSISTmysqld-auto.cnf
| |
C:\my.ini | |
| |
defaults-extra-file | --defaults-extra-file |
| |
| SET
PERSIST |
%WINDIR%WINDIR
C:\> echo %WINDIR%
%APPDATA%
C:\> echo %APPDATA%
BASEDIRPROGRAMDIRPROGRAMDIR
DATADIR--datadir
/etc/my.cnf | |
/etc/mysql/my.cnf | |
| |
$MYSQL_HOME/my.cnf | |
defaults-extra-file | --defaults-extra-file |
~/.my.cnf | |
~/.mylogin.cnf | |
| SET
PERSIST |
~
SYSCONFDIRSYSCONFDIRetc
MYSQL_HOMEMYSQL_HOMEBASEDIR
DATADIR--datadir
--user
.mylogin.cnfmysqld-auto.cnf
--help--verbose--help
--quick--host=localhostquickhost=localhost--loose-opt_nameopt_name
#commentcomment
##
[group]
group
opt_name
--opt_name
opt_name=value
--opt_name=value=#
\b\n\\
\s
\S
\\
xxxx
\\\/C:\Program Files\MySQL\MySQL Server
8.0
basedir="C:\Program Files\MySQL\MySQL Server 8.0"basedir="C:\\Program Files\\MySQL\\MySQL Server 8.0"basedir="C:/Program Files/MySQL/MySQL Server 8.0"basedir=C:\\Program\sFiles\\MySQL\\MySQL\sServer\s8.0
[mysqld]
[client]
[client][client]
[client][client][client]
[client] port=3306 socket=/tmp/mysql.sock [mysqld] port=3306 socket=/tmp/mysql.sock key_buffer_size=16M max_allowed_packet=128M [mysqldump] quick
[client] # The following password will be sent to all standard MySQL clients password="my password" [mysql] no-auto-rehash connect_timeout=2
[mysqld-5.7]sql_mode
[mysqld-8.0]sql_mode=TRADITIONAL
!include/home/mydir/myopt.cnf
!包括/家/不要/ myopt.cnf
/home/mydir
!includedir /家/函数
!includedir.cnf.cnf
[group]
my.cnf
!包括/家/不要/ myopt.cnf
/home/mydir/myopt.cnf
[mysqladmin]force[mysqld]key_buffer_size=16M
my.cnf[mysqld][mysqladmin]
!includedir
!include
--print-defaults--defaults-file--defaults-extra-file--login-path
--defaults-file--install--install
~
--defaults-extra-file=file_name
file_name
file_name
--defaults-filemysqld-auto.cnf
str[client]--defaults-group-suffix=_other[client_other]
.mylogin.cnf
shell> mysql --login-path=mypath
[client][client][client][mypath]
--no-defaults
MYSQL_TEST_LOGIN_FILE
--no-defaults
.mylogin.cnf--no-defaults--no-defaults
SET
max_allowed_packet
shell>mysql --max_allowed_packet=16777216shell>mysql --max_allowed_packet=16M
KGmax_allowed_packetP
[mysql] max_allowed_packet=16777216
[mysql] max_allowed_packet=16M
[mysqld] key_buffer_size=512M [mysqld] key-buffer-size=512M
max_allowed_packet--max_a
shell> mysql --max=1000000
mysql: ambiguous option '--max=1000000' (max_allowed_packet, max_join_size)
SETSET
内核> mysql --max_allowed_packet=16M内核> mysql --max_allowed_packet=16*1024*1024
mysql>SET GLOBAL max_allowed_packet=16M;mysql>SET GLOBAL max_allowed_packet=16*1024*1024;
=
内核> mysql --host=tonfisk --user=jon
shell> mysql --host tonfisk --user jon
tonfisk
shell>mysql --host 85.224.35.45 --user jonWelcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 8.0.14 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>SELECT CURRENT_USER();+----------------+ | CURRENT_USER() | +----------------+ | jon@% | +----------------+ 1 row in set (0.00 sec)
shell> mysql --host 85.224.35.45 --user
mysql: option '--user' requires an argument
--user
shell> mysql --host --user jon
ERROR 2005 (HY000): Unknown MySQL server host '--user' (1)
--host--host--user--host=--user
--log-errorhost_namehost_name
shell> mysqld_safe &
[1] 11699
shell> 080112 12:53:40 mysqld_safe Logging to '/usr/local/mysql/var/tonfisk.err'.
080112 12:53:40 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
shell>
shell> mysqld_safe --log-error &
[1] 11699
shell> 080112 12:53:40 mysqld_safe Logging to '/usr/local/mysql/var/tonfisk.err'.
080112 12:53:40 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
shell>
--log-errormy-errors.err
shell> mysqld_safe --log-error my-errors &
[1] 31357
shell> 080111 22:53:31 mysqld_safe Logging to '/usr/local/mysql/var/tonfisk.err'.
080111 22:53:32 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
080111 22:53:34 mysqld_safe mysqld from pid file /usr/local/mysql/var/tonfisk.pid ended
[1]+ Done ./mysqld_safe --log-error my-errors
/usr/local/mysql/var/tonfisk.err
内核> tail /usr/local/mysql/var/tonfisk.err2013-09-24t15:36: 22.278034z 0 [错误]的参数太多(第一个额外的是“我的错误”)。2013-09-24t15:36: 22.278059z 0 [注]使用冗长的帮助你获得一个可用的选项!2013-09-24t15:36: 22.278076z 0 [错误] 0 [注] aborting2013-09-24t15:36: 22.279704z InnoDB:开始关闭…2013-09-24t15:36: 23.777471z 0 [注]:关闭InnoDB完成;日志序列号23190862013-09-24t15:36: 23.780134z 0 [注]:关闭mysqld完成
--log-error
内核> mysqld_safe --log-error=my-errors &[1] 31437shell> 080111 22:54:15 mysqld_safe Logging to '/usr/local/mysql/var/my-errors.err'.080111 22:54:15 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/varshell>
/usr/local/mysql/var/my-errors.err
my.cnf
[ ] hostuser MySQL
--host--user--host=--user
内核> mysql错误2005(未知hy000):MySQL服务器主机的用户(1)
my.cnf
[ ]乔恩的MySQL用户
shell> mysql
mysql: unknown option '--user jon'
host
tonfiskhost=tonfisk
[mysql] user=jon
shell>mysqlWelcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 8.0.14 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>SELECT USER();+---------------+ | USER() | +---------------+ | jon@localhost | +---------------+ 1 row in set (0.00 sec)
shell>mysql --user jon --host tonfiskWelcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 8.0.14 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>SELECT USER();+---------------+ | USER() | +---------------+ | jon@tonfisk | +---------------+ 1 row in set (0.00 sec)
my.cnf
[他] log_errorrelay_logrelay_log_index
shell> mysqld_safe &
130924 10:41:46 mysqld_safe Logging to '/home/jon/bin/mysql/var/tonfisk.err'.
130924 10:41:46 mysqld_safe Starting mysqld daemon with databases from /home/jon/bin/mysql/var
130924 10:41:47 mysqld_safe mysqld from pid file /home/jon/bin/mysql/var/tonfisk.pid ended
--log-error--relay-logdatadirhostname
内核> tail -n 3 ../var/tonfisk.err130924 10:41:46 mysqld_safe启动mysqld进程从/家/乔恩/斌/ MySQL / var2013-09-24t15:41: 47.217180z 0 [错误] /家/乔恩/斌/ MySQL / libexec / mysqld数据库:选项--中继日志”需要一个argument2013-09-24t15:41: 47.217479z 0 [错误]中止
my.cnf--relay-log=relay_log_index
USER
SET USER=your_nameMYSQL_TCP_PORT
MYSQL_TCP_PORT=3306 export MYSQL_TCP_PORT
export
setenv MYSQL_TCP_PORT 3306
.bashrc.tcshrc
/usr/local/mysql/bin.bashrc
PATH=${PATH}:/usr/local/mysql/bin.bashrcPATH
.tcshrc
setenv:路径路径元{ } /usr/local MySQL/AM
PATH
shell> mysqld --verbose --help
--mysqld--mysqld-version--ledir
[mysqld_safe]
[mysqld][mysqld_safe]--log-error
[mysqld]log-error=error.log
[safe_mysqld]
--defaults-extra-file=file_name
file_name
file_name
MYSQLD_OPTS
UTC
UTC
--log_timestamps=UTC
SYSTEM
--log_timestamps=SYSTEM
HYPHEN
YY-MM-DD h:mm:ss
LEGACY
YYMMDD hh:mm:ss
malloc()/usr/lib64/usr/lib/x86_64-linux-gnu
--malloc-lib
--malloc-lib=tcmalloc
--malloc-lib=tcmalloctcmalloctmalloctcmalloc
--malloc-lib=/path/to/some/library
LD_PRELOAD
LD_PRELOAD
libtcmalloc_minimal.so/usr/lib
[mysqld_safe] malloc-lib=tcmalloc
tcmalloc
[mysqld_safe]malloc-lib=/opt/lib/libtcmalloc_minimal.so
ledir--ledir
MYSQLD_OPTS
--mysqld--mysqld-version=debugledir--mysqld-versionledir
MYSQLD_OPTS
nice
--no-defaults
root
root
--syslog--skip-syslog
syslog
log_syslog_facility
syslogmysqld_safe--syslog-tag=tagtagtag
log_syslog_tag
TZ
user_nameuser_id
--defaults-file--defaults-extra-file
MySQL的> mysqld_safe --port=port_num--defaults-file=file_name
mysql> mysqld_safe --defaults-file=file_name --port=port_num
binlibexec/usr/local/mysql
/usr/local/libexec
shell>cdshell>mysql_installation_directorybin/mysqld_safe &
--ledir--datadir
--log-error=file_name
--syslog
--skip-sysloghost_name.err--log-error
--skip-syslog
syslogstderr
syslog
start
shell>mysql.server startshell>mysql.server stop
user/etc/my.cnf
/etc/rc*
MySQL-server-VERSION.rpm/etc/init.dmysql
support-files
shell>cp mysql.server /etc/init.d/mysqlshell>chmod +x /etc/init.d/mysql
shell> chkconfig --add mysql
shell> chkconfig --level 345 mysql on
/usr/local/etc/rc.d//usr/local/etc/rc.d/mysql.server.sh*.sh
/etc/rc.local
/bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'
[mysql.server][mysql_server]
/etc/my.cnf
[mysqld] datadir=/usr/local/mysql/var socket=/var/tmp/mysql.sock port=3306 user=mysql [mysql.server] basedir=/usr/local/mysql
start
basedir | ||
datadir | ||
pid-file | ||
service-startup-timeout |
host_name.pid[mysqld_safe][mysqld]pid-file[mysqld]
service-startup-timeout=seconds
[mysqldN]--defaults-fileNGNR[mysqld]
shell> mysqld_multi [options] {start|stop|reload|report} [GNR[,GNR] ...]
startreloadGNR
GNRGNR17GNR[mysqld10]GNR
[mysqld17]
内核> mysqld_multi start 17
[mysqld8][mysqld13]
内核> mysqld_multi stop 8,10-13
shell> mysqld_multi --example
--no-defaults
--defaults-file=file_name
--defaults-extra-file=file_name
[mysqld_multi]N[mysqldN]
[mysqld]--defaults-file=file_name[mysqld_safe]
mysqld[mysqldN]
[mysqld38] mysqld = mysqld-debug ledir = /opt/local/mysql/libexec
stdout
stop
root
SHUTDOWN
shell>mysql -u root -S /tmp/mysql.sock -pEnter password: mysql>CREATE USER 'multi_admin'@'localhost' IDENTIFIED BY 'multipass';mysql>GRANT SHUTDOWN ON *.* TO 'multi_admin'@'localhost';
multi_admin
--bind-address
--pid-file--mysqld=mysqld_safekill
-9
--userroot
[mysqldN]
# This is an example of a my.cnf file for mysqld_multi. # Usually this file is located in home dir ~/.my.cnf or /etc/my.cnf [mysqld_multi] mysqld = /usr/local/mysql/bin/mysqld_safe mysqladmin = /usr/local/mysql/bin/mysqladmin user = multi_admin password = my_password [mysqld2] socket = /tmp/mysql.sock2 port = 3307 pid-file = /usr/local/mysql/data2/hostname.pid2 datadir = /usr/local/mysql/data2 language = /usr/local/mysql/share/mysql/english user = unix_user1 [mysqld3] mysqld = /path/to/mysqld_safe ledir = /path/to/mysqld-binary/ mysqladmin = /path/to/mysqladmin socket = /tmp/mysql.sock3 port = 3308 pid-file = /usr/local/mysql/data3/hostname.pid3 datadir = /usr/local/mysql/data3 language = /usr/local/mysql/share/mysql/swedish user = unix_user2 [mysqld4] socket = /tmp/mysql.sock4 port = 3309 pid-file = /usr/local/mysql/data4/hostname.pid4 datadir = /usr/local/mysql/data4 language = /usr/local/mysql/share/mysql/estonia user = unix_user3 [mysqld6] socket = /tmp/mysql.sock6 port = 3311 pid-file = /usr/local/mysql/data6/hostname.pid6 datadir = /usr/local/mysql/data6 language = /usr/local/mysql/share/mysql/japanese user = unix_user4
errmsg.syserrmsg.sys
mysqld_error.hsql_state.h
shell> comp_err [options]
--help
--charset=dir_namedir_name
../sql/share/charsets
--debug=debug_optionsdebug_options
debug_optionsfile_name
--header_file=file_namefile_name
mysqld_error.h
--in_file=file_namefile_name
../sql/share/errmsg-utf8.txt
--name_file=file_namefile_name
mysqld_ername.h
--out_dir=dir_namedir_name
../sql/share/
--out_file=file_namefile_name
errmsg.sys
--statefile=file_namefile_name
sql_state.h
root
root
test
shell> mysql_secure_installation
validate_password
--host--port
内核> mysql_secure_installation --host=::1 --port=3307
[mysql_secure_installation]
--help
--defaults-extra-file=file_name
file_name
file_name
str[client]--defaults-group-suffix=_other[client_other]
--host=host_namehost_name
--no-defaults
.mylogin.cnf--no-defaults
--password=passwordpassword
--port=port_numport_num
--protocol={TCP|SOCKET|PIPE|MEMORY}
--socket=pathpath
localhost
--ssl
--ssl-fips-mode={OFF|ON|STRICT}
--ssl-fips-modexxx
--ssl-fips-mode
OFF
ON
STRICT
--ssl-fips-mode--ssl-fips-modeSTRICT
--user=user_nameuser_name
shell> mysql_ssl_rsa_setup [options]
--datadir--verbose
PATH--datadir--datadir
ca.pem server-cert.pem server-key.pem
ca.pem Self-signed CA certificate ca-key.pem CA private key server-cert.pem Server certificate server-key.pem Server private key client-cert.pem Client certificate client-key.pem Client private key
private_key.pem Private member of private/public key pair public_key.pem Public member of private/public key pair
sha256_password
--ssl--ssl-cipher--ssl-ca--ssl-cert--ssl-keyserver-cert.pem
--ssl-ca--ssl-cert--ssl-keyclient-cert.pem
cp ca.pem client-cert.pem client-key.pem ..
--datadir
[mysql_ssl_rsa_setup]
--help
root
mysql/usr/share/zoneinfo
shell>mysql_tzinfo_to_sqlshell>tz_dirmysql_tzinfo_to_sqlshell>tz_file tz_namemysql_tzinfo_to_sql --leaptz_file
shell> mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
tz_filetz_name
内核> mysql_tzinfo_to_sqltz_filetz_name| mysql -u root mysql
tz_file
内核> mysql_tzinfo_to_sql --leaptz_file| mysql -u root mysql
shell> mysql_upgrade [options]
shell>mysql_upgrade --protocol=tcp -P 3306 [shell>other_options]mysql_upgrade --protocol=tcp -P 3307 [shell>other_options]mysql_upgrade --protocol=tcp -P 3308 [other_options]
--protocol=tcp
disabled_storage_engines
mysql_upgrade: [ERROR] 3161: Storage engine MyISAM is disabled (Table creation is disallowed).
disabled_storage_enginesdisabled_storage_engines
FOR UPGRADECHECK TABLE
mysql_upgrade_info--force
user'mysql_native_password'
--skip-sys-schemasyssys
Error occurred: A sys schema exists with no sys.version view. If you have a user created sys schema, this must be renamed for the upgrade to succeed.
sys
InnoDBALTER
TABLE ... UPGRADE PARTITIONING
rootrootroot
内核> mysql -u root -p输入密码: ****<- enter root password here
ALTER
USER
MySQL的> ALTER USER USER() IDENTIFIED BY 'root-password';
shell> mysql_upgrade [options]
[mysql_upgrade]
--debug[=debug_options]debug_options
debug_optionsfile_name
--default-character-set=charset_name
charset_name
--defaults-extra-file=file_name
file_name
file_name
str[client]--defaults-group-suffix=_other[client_other]
mysql_upgrade_info
caching_sha2_password
--server-public-key-path=file_name--get-server-public-key
caching_sha2_password
--host=host_namehost_name
.mylogin.cnf
--no-defaults
.mylogin.cnf--no-defaults
--password[=password]password
-ppassword--password
--pipe
--default-auth
--port=port_numport_num
--protocol={TCP|SOCKET|PIPE|MEMORY}
--server-public-key-path=file_name
sha256_password
--server-public-key-path=file_name--get-server-public-key
sha256_password
sha256_password
--shared-memory-base-name=name
MYSQL
--shared-memory
sys--skip-sys-schema
--socket=pathpath
localhost
--ssl
--ssl-fips-mode={OFF|ON|STRICT}
--ssl-fips-modexxx
--ssl-fips-mode
OFF
ON
STRICT
--ssl-fips-mode--ssl-fips-modeSTRICT
--user=user_nameuser_name
root
--skip-version-check
--write-binlog
gtid_mode=ON
--quickmysql_use_result()mysql_store_result()
shell> mysql db_name
shell>mysql --user=Enter password:user_name--passworddb_nameyour_password
;\G
shell> mysql db_name < script.sql > output.tab
[mysql]
--help
--disable-auto-rehashrehash
;
--batch
--raw
0xvalue
BLOB\r\n\0--binary-modecharsetsource
--skip-comments--comments
--database=db_namedb_name
--debug[=debug_options]debug_options
debug_optionsfile_name
WITH_DEBUG
--default-character-set=charset_name
charset_name
--defaults-extra-file=file_name
file_name
file_name
--defaults-file
str[client]--defaults-group-suffix=_other[client_other]
;
\*
mysql_clear_password
--execute=statementstatement
--batch
--force
caching_sha2_password
--server-public-key-path=file_name--get-server-public-key
caching_sha2_password
"*IDENTIFIED*:*PASSWORD*"--syslog
--host=host_namehost_name
--html
IGNORE_SPACE
--skip-line-numbers
LOCALLOAD DATA
INFILELOCAL--local-infile=0--local-infile=1
.mylogin.cnf
quit--skip-named-commands
--skip-auto-rehash--auto-rehash
--no-defaults
.mylogin.cnf--no-defaults
USE
db_nameUSE
db_nameUSE
DELETE FROM db2.t2; USE db2; DROP TABLE db1.t1; CREATE TABLE db1.t1 (i INT); USE db1; INSERT INTO t1 (i) VALUES(1); CREATE TABLE db2.t1 (j INT);
DELETE
DROP TABLECREATE TABLEdb1
INSERTCREATE TABLECREATE TABLE
PAGER--skip-pager
--password[=password]password
-ppassword--password
--pipe
--default-auth
--port=port_numport_num
mysql>
--protocol={TCP|SOCKET|PIPE|MEMORY}
--quick
--raw
--batch--silent\n\0--raw
%mysqlmysql> SELECT CHAR(92); +----------+ | CHAR(92) | +----------+ | \ | +----------+ %mysql -smysql> SELECT CHAR(92); CHAR(92) \\ %mysql -s -rmysql> SELECT CHAR(92); CHAR(92) \
--skip-reconnect
--safe-updates--i-am-a-dummy
UPDATEDELETE--safe-updates
--server-public-key-path=file_name
sha256_password
--server-public-key-path=file_name--get-server-public-key
sha256_password
--shared-memory-base-name=name
MYSQL
--shared-memory
SIGINT
--silent
--raw
--socket=pathpath
localhost
--ssl
--ssl-fips-mode={OFF|ON|STRICT}
--ssl-fips-modexxx
--ssl-fips-mode
OFF
ON
STRICT
--ssl-fips-mode--ssl-fips-modeSTRICT
--syslog
syslog
--syslog
12月25 myhost 7::[ 39 ]:系统mysqlclient 20824 _ MySQL用户:用户:奥斯卡,奥斯卡是我_ _ connection ID号:23,_ DB服务器,_:127.0.0.1,DB—,::是使用测试查询;7日:12 39 [ 28 ]:myhost mysqlclient 20824 _:系统用户:用户:MySQL _奥斯卡,奥斯卡是我_ connection ID号:23,_ DB服务器,_:127.0.0.1测试:是,是,DB查询:显示表;
--table
--user=user_nameuser_name
-v -v
-v
\G
--wait
--xml
<field name="column_name">NULL</field>
--xml--xml
shell> mysql --xml -uroot -e "SHOW VARIABLES LIKE 'version%'"
<?xml version="1.0"?>
<resultset statement="SHOW VARIABLES LIKE 'version%'" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<field name="Variable_name">version</field>
<field name="Value">5.0.40-debug</field>
</row>
<row>
<field name="Variable_name">version_comment</field>
<field name="Value">Source distribution</field>
</row>
<row>
<field name="Variable_name">version_compile_machine</field>
<field name="Value">i686</field>
</row>
<row>
<field name="Variable_name">version_compile_os</field>
<field name="Value">suse-linux-gnu</field>
</row>
</resultset>
--var_name=value
0
--safe-updates
SELECT--safe-updates
helpmysql>
mysql> help
List of all MySQL commands:
Note that all text commands must be first on line and end with ';'
? (\?) Synonym for `help'.
clear (\c) Clear the current input statement.
connect (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
edit (\e) Edit command with $EDITOR.
ego (\G) Send command to mysql server, display result vertically.
exit (\q) Exit mysql. Same as quit.
go (\g) Send command to mysql server.
help (\h) Display this help.
nopager (\n) Disable pager, print to stdout.
notee (\t) Don't write into outfile.
pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print (\p) Print current command.
prompt (\R) Change your mysql prompt.
quit (\q) Quit mysql.
rehash (\#) Rebuild completion hash.
source (\.) Execute an SQL script file. Takes a file name as an argument.
status (\s) Get status information from the server.
system (\!) Execute a system shell command.
tee (\T) Set outfile [to_outfile]. Append everything into given
outfile.
use (\u) Use another database. Takes database name as argument.
charset (\C) Switch to another charset. Might be needed for processing
binlog with multi-byte charsets.
warnings (\W) Show warnings after every statement.
nowarning (\w) Don't show warnings after every statement.
resetconnection(\x) Clean session context.
For server side help, type 'help contents'
--binary-modecharsetsource
/*
... */
help [arg]argargarg
help
charset
charset_namecharset_name
SET NAMES
connect [db_name
host_name]]db_namehost_name
;
delimiter"\
XINDE
;
EDITOR
edit
pager
nopager
tee
--pagerPAGER
pagerstdout
popen()pager
promptmysql>
--auto-rehash
mysql_change_user()
resetconnection
MySQL的> SELECT LAST_INSERT_ID(3);----------------------- |负荷_插入_ ID(3)| ----------------------- | | ----------------------- MySQL>3 SELECT LAST_INSERT_ID();_ ------------------ |负载插入_ ID(3)| ------------------ | MySQL > | ------------------ resetconnection;MySQL的> SELECT LAST_INSERT_ID();------------------ | last_insert_id() | ------------------ | 0 | ------------------
/
--safe-updates
system
--tee
teenotee
db_name
pager
mysql> pager cat > /tmp/log.txt
mysql> pager less -n -i -S
-S-S
shell> man less
-F
mysql> pager less -n -i -S -F -X
mysql>pager cat | tee /dr1/tmp/res.txt \| tee /dr2/tmp/res2.txt | less -n -i -S
/dr1
teeteeteeteeteepager
prompt
\C | |
\c | |
\D | |
\d | |
\h | |
\l | |
\m | |
\n | |
\O | |
\o | |
\P | |
\p | |
\R | |
\r | |
\S | |
\s | |
\t | |
\U |
|
\u | |
\v | |
\w | |
\Y | |
\y | |
\_ | |
\ | |
\' | |
\" | |
\\ | \ |
\ |
|
MYSQL_PS1
内核> export MYSQL_PS1="(\u@\h) [\d]> "
--prompt
shell> mysql --prompt="(\u@\h) [\d]> "
(user@host) [database]>
prompt/etc/my.cnf
[mysql] prompt=(\\u@\\h) [\\d]>\\_
prompt\s
[mysql] prompt="\\r:\\m:\\s> "
prompt
mysql>prompt (\u@\h) [\d]>\_PROMPT set to '(\u@\h) [\d]>\_' (user@host) [database]> (user@host) [database]> prompt Returning to default PROMPT of mysql> mysql>
mysql>SELECT->'Today is'->,->CURDATE()->;
SELECT\n'Today
is'\n,\nCURDATE()
SELECT 'Today is' , CURDATE() ; SELECT 'Today is' , CURDATE();
"*IDENTIFIED*:*PASSWORD*"
?
*
--histignore
UPDATE
shell> mysql --histignore="*UPDATE*:*DELETE*"
.mysql_history
.mysql_history
MYSQL_HISTFILE
.mysql_history
shell> ln -s /dev/null $HOME/.mysql_history
--syslog
LOG_INFOsyslog
MysqlClient
SYSTEM_USER
--
MYSQL_USER
--user
CONNECTION_ID
CONNECTION_ID()
DB_SERVER
--
DB
--
QUERY
--syslog
12月25 myhost 7::[ 39 ]:系统mysqlclient 20824 _ MySQL用户:用户:奥斯卡,奥斯卡是我_ _ connection ID号:23,_ DB服务器,_:127.0.0.1,DB—,::是使用测试查询;7日:12 39 [ 28 ]:myhost mysqlclient 20824 _:系统用户:用户:MySQL _奥斯卡,奥斯卡是我_ connection ID号:23,_ DB服务器,_:127.0.0.1测试:是,是,DB查询:显示表;
mysql> help search_string
helpmysql
mysql> help me
Nothing found
Please try to run 'help contents' for a list of all accessible topics
mysql> help contents
You asked for help about help category: "Contents"
For more information, type 'help <item>', where <item> is one of the
following categories:
Account Management
Administration
Data Definition
Data Manipulation
Data Types
Functions
Functions and Modifiers for Use with GROUP BY
Geographic Features
Language Structure
Plugins
Storage Engines
Stored Routines
Table Maintenance
Transactions
Triggers
mysql> help logs
Many help items for your request exist.
To make a more specific request, please type 'help <item>',
where <item> is one of the following topics:
SHOW
SHOW BINARY LOGS
SHOW ENGINE
SHOW LOGS
mysql> help show binary logs
Name: 'SHOW BINARY LOGS'
Description:
Syntax:
SHOW BINARY LOGS
SHOW MASTER LOGS
Lists the binary log files on the server. This statement is used as
part of the procedure described in [purge-binary-logs], that shows how
to determine which logs can be purged.
mysql> SHOW BINARY LOGS;
+---------------+-----------+
| Log_name | File_size |
+---------------+-----------+
| binlog.000015 | 724935 |
| binlog.000016 | 733481 |
+---------------+-----------+
%LIKErep
MySQL的> HELP rep%Many help items for your request exist.To make a more specific request, please type 'help <item>',where <item> is one of the followingtopics: REPAIR TABLE REPEAT FUNCTION REPEAT LOOP REPLACE REPLACE FUNCTION
shell> mysql db_name
text_file
shell> mysql db_name < text_file
USE
db_name
内核> mysql < text_file
source
mysql>sourcemysql>file_name\.file_name
SELECT '<info_to_display>' AS ' ';
<info_to_display>
--verbose
--default-character-set=utf8
libedit
libedit.editrc.inputrc
libeditreadlinelibedit.editrc
结合“^ W“删除”沪指wordbind ^ U”VI杀线沪指
bind
MySQL command
line client - Unicode
--default-character-set=utf8utf16le
--default-character-set=utf8
[mysql]
[mysql] default-character-set=utf8
mysql> SELECT * FROM mails WHERE LENGTH(txt) < 300 LIMIT 300,1\G
*************************** 1. row ***************************
msg_nro: 3068
date: 2000-03-01 23:29:50
time_zone: +0200
mail_from: Monty
reply: monty@no.spam.com
mail_to: "Thimble Smith" <tim@no.spam.com>
sbj: gb3212
txt: >>>>> "Thimble" == Thimble Smith writes:
Thimble> Hi. I think this is a good idea. Is anyone familiar
Thimble> with gb3212 or Unicode? Otherwise, I'll put this on my
Thimble> TODO list and see what happens.
Yes, please do that.
Regards,
Monty
file: inbox-jani-1
hash: 190402944
1 row in set (0.09 sec)
--safe-updates--i-am-a-dummytbl_name--safe-updates
--safe-updates
SET sql_safe_updates=1, sql_select_limit=1000, max_join_size=1000000;
SET
--select_limit
shell> mysql --safe-updates --select_limit=500 --max_join_size=10000
mysql>SET @a=1;Query OK, 0 rows affected (0.05 sec) mysql>INSERT INTO t VALUES(@a);ERROR 2006: MySQL server has gone away No connection. Trying to reconnect... Connection id: 1 Current database: test Query OK, 1 row affected (1.30 sec) mysql>SELECT * FROM t;+------+ | a | +------+ | NULL | +------+ 1 row in set (0.05 sec)
@a--skip-reconnect
shell> mysqladmin [options] command [command-arg] [command [command-arg]] ...
db_name
SUPER
db_name
flush-logsenginegeneralslowFLUSH
LOGS
reload
CONNECTION_ADMINSUPER
new_password
new_password
内核> mysqladmin password "my new password"
passwordpassword
--skip-grant-tablesflush-privileges
Access denied
SHOW
PROCESSLIST--verboseSHOW FULL
PROCESSLIST
shell> mysqladmin proc stat
+----+-------+-----------+----+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+-------+-----------+----+---------+------+-------+------------------+
| 51 | monty | localhost | | Query | 0 | | show processlist |
+----+-------+-----------+----+---------+------+-------+------------------+
Uptime: 1473624 Threads: 1 Questions: 39487
Slow queries: 0 Opens: 541 Flush tables: 1
Open tables: 19 Queries per second avg: 0.0268
long_query_time
flush-*reload
[mysqladmin]
--help
--count=NN
--sleep
--debug[=debug_options]debug_options
debug_optionsfile_name
--default-character-set=charset_name
charset_name
--defaults-extra-file=file_name
file_name
file_name
--defaults-file
str[client]--defaults-group-suffix=_other[client_other]
mysql_clear_password
--force
drop
db_name
caching_sha2_password
--server-public-key-path=file_name--get-server-public-key
caching_sha2_password
--host=host_namehost_name
.mylogin.cnf
--no-defaults
.mylogin.cnf--no-defaults
--password[=password]password
-ppassword--password
--pipe
--default-auth
--port=port_numport_num
--protocol={TCP|SOCKET|PIPE|MEMORY}
--sleep
--server-public-key-path=file_name
sha256_password
--server-public-key-path=file_name--get-server-public-key
sha256_password
sha256_password
--shared-memory-base-name=name
MYSQL
--shared-memory
--silent
--sleep=delaydelay
delay--count--count
--socket=pathpath
localhost
--ssl
--ssl-fips-mode={OFF|ON|STRICT}
--ssl-fips-modexxx
--ssl-fips-mode
OFF
ON
STRICT
--ssl-fips-mode--ssl-fips-modeSTRICT
--user=user_nameuser_name
--relative
--wait[=count]count
count
--var_name=value
READREAD--databases--all-databases
CHECK TABLEREPAIR TABLEANALYZE TABLEOPTIMIZE TABLE
test.t
shell> mysqlcheck test t
test.t
note : The storage engine for the table doesn't support check
InnoDBCHECK TABLEREPAIR TABLE
shell>mysqlcheck [shell>options]db_name[tbl_name...]mysqlcheck [shell>options] --databasesdb_name...mysqlcheck [options] --all-databases
db_name--databases--all-databases
--check
--repair | |
--analyze | |
--optimize |
[mysqlcheck]
--help
--databasesperformace_schema--databases
--all-in-1
--analyze
--check
CHECK TABLE
--debug[=debug_options]debug_options
debug_optionsfile_name
--default-character-set=charset_name
charset_name
--defaults-extra-file=file_name
file_name
file_name
--defaults-file
str[client]--defaults-group-suffix=_other[client_other]
mysql_clear_password
--fast
--force
caching_sha2_password
--server-public-key-path=file_name--get-server-public-key
caching_sha2_password
--host=host_namehost_name
.mylogin.cnf
--extended
--no-defaults
.mylogin.cnf--no-defaults
--optimize
--password[=password]password
-ppassword--password
--pipe
--default-auth
--port=port_numport_num
--protocol={TCP|SOCKET|PIPE|MEMORY}
--quick
--repair
--server-public-key-path=file_name
sha256_password
--server-public-key-path=file_name--get-server-public-key
sha256_password
sha256_password
--shared-memory-base-name=name
MYSQL
--shared-memory
--silent
--socket=pathpath
localhost
--ssl
--ssl-fips-mode={OFF|ON|STRICT}
--ssl-fips-modexxx
--ssl-fips-mode
OFF
ON
STRICT
--ssl-fips-mode--ssl-fips-modeSTRICT
--databases
MyISAM
--user=user_nameuser_name
ANALYZE TABLEOPTIMIZE TABLEREPAIR TABLE--skip-write-binlog--skip-write-binlog
SELECTSHOW VIEWTRIGGERLOCK TABLES--single-transaction
CREATE
ALTER DATABASE
shell> mysqldump [options] > dump.sql
--result-file
内核> mysqldump [options] --result-file=dump.sql
mysqldump
InnoDBMyISAMInnoDB
--quick--opt--quick--opt--quick--skip-quick
--skip-opt--opt--extended-insert
shell>mysqldump [shell>options]db_name[tbl_name...]mysqldump [shell>options] --databasesdb_name...mysqldump [options] --all-databases
db_name--databases--all-databases
[mysqldump]
| Enclose the INSERT statements for each dumped table within SET autocommit = 0 and COMMIT statements | |||
| Add SET TIME_ZONE='+00:00' to dump file | |||
mysql_clear_password
caching_sha2_password
--server-public-key-path=file_name--get-server-public-key
caching_sha2_password
localhost
.mylogin.cnf
max_allowed_packet--skip-network-timeout
--password[=password]password
-ppassword-p
--default-auth
--protocol={TCP|SOCKET|PIPE|MEMORY}
--server-public-key-path=file_name
sha256_password
--server-public-key-path=file_name--get-server-public-key
sha256_password
sha256_password
localhost
--ssl
--ssl-fips-mode={OFF|ON|STRICT}
--ssl-fips-modexxx
--ssl-fips-mode
OFF
ON
STRICT
--ssl-fips-mode--ssl-fips-modeSTRICT
--var_name=value
INSERT--extended-insert--optnet_buffer_lengthnet_buffer_length
--defaults-extra-file=file_name
file_name
file_name
--defaults-file
str[client]--defaults-group-suffix=_other[client_other]
--no-defaults
.mylogin.cnf--no-defaults
DROP DATABASECREATE
DATABASE--all-databases--databasesCREATE DATABASE
DROP TABLECREATE TABLE
DROP TRIGGERCREATE
TRIGGER
NDB
CREATE DATABASE--databases--all-databases
CREATE TABLE
--no-tablespaces
CREATE
LOGFILE GROUPCREATE
TABLESPACE
--skip-comments
--debug[=debug_options]debug_options
debug_optionsfile_name
--comments
-- Dump completed on DATE
--dump-date--skip-dump-date--dump-date--skip-dump-date
--force--force
--ignore-error--force
--comments
--default-character-set=charset_name
charset_nameutf8
--set-charset
SET NAMES
default_character_setSET NAMES--skip-set-charset
--dump-slaveSTOP SLAVECHANGE MASTER TOSTART SLAVE
PURGE BINARY LOGS--master-data
--master-dataCHANGE MASTER TOCHANGE MASTER TOExec_Master_Log_PosSHOW SLAVE STATUSMASTER_LOG_POS
--dump-slave--master-data
gtid_mode=ONMASTER_AUTOPOSITION=1
--master-data--master-data
--dump-slave--apply-slave-statements--include-master-host-port
CHANGE MASTER TO--dump-slaveMASTER_PORT
CHANGE MASTER TO
CHANGE
MASTER TO
RELOAD
--master-data--lock-tables--lock-all-tables--single-transaction--single-transaction
--dump-slave
SET
@@global.gtid_purged
AUTO
OFF | SET |
ON | SET |
AUTO | SET |
--set-gtid-purged={ON|OFF}OFF
--set-gtid-purged
--set-gtid-purged=OFFSET @@SESSION.SQL_LOG_BIN=0;
--set-gtid-purged=ONSET @@SESSION.SQL_LOG_BIN=0;
--set-gtid-purged=AUTOSET @@SESSION.SQL_LOG_BIN=0;AUTO
gtid_mode=ON
--skip-add-drop-table--skip-add-locks--skip-comments--skip-disable-keys--skip-set-charset
ansi
INSERT
CREATE TABLE
--fields-terminated-by=...--fields-enclosed-by=...--fields-optionally-enclosed-by=...--fields-escaped-by=...
--tabLOAD
DATA INFILE
'abc'BINARYVARBINARYBLOBBIT
--tabLOAD
DATA INFILE
`ANSI_QUOTES--skip-quote-names--compatible--quote-names
--result-file=file_namefile_name
\n
tbl_name.sqlCREATE
TABLEtbl_name
*.txtFILE*.sql
.txtxxx--lines-terminated-by
--default-character-set
TIMESTAMPSET
TIME_ZONE='+00:00'TIMESTAMP--tz-utc
NULLcolumn_name'NULL'
NULL |
|
'' |
|
'NULL' |
|
--xml
shell>mysqldump --xml -u root world City<?xml version="1.0"?> <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <database name="world"> <table_structure name="City"> <field Field="ID" Type="int(11)" Null="NO" Key="PRI" Extra="auto_increment" /> <field Field="Name" Type="char(35)" Null="NO" Key="" Default="" Extra="" /> <field Field="CountryCode" Type="char(3)" Null="NO" Key="" Default="" Extra="" /> <field Field="District" Type="char(20)" Null="NO" Key="" Default="" Extra="" /> <field Field="Population" Type="int(11)" Null="NO" Key="" Default="0" Extra="" /> <key Table="City" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="ID" Collation="A" Cardinality="4079" Null="" Index_type="BTREE" Comment="" /> <options Name="City" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="4079" Avg_row_length="67" Data_length="273293" Max_data_length="18858823439613951" Index_length="43008" Data_free="0" Auto_increment="4080" Create_time="2007-03-31 01:47:01" Update_time="2007-03-31 01:47:02" Collation="latin1_swedish_ci" Create_options="" Comment="" /> </table_structure> <table_data name="City"> <row> <field name="ID">1</field> <field name="Name">Kabul</field> <field name="CountryCode">AFG</field> <field name="District">Kabol</field> <field name="Population">1780000</field> </row>...<row> <field name="ID">4079</field> <field name="Name">Rafah</field> <field name="CountryCode">PSE</field> <field name="District">Rafah</field> <field name="Population">92020</field> </row> </table_data> </database> </mysqldump>
WHERE
--databases
--routines--events--all-databasesmysql.procmysql.event--all-databases--routines--events
CREATE
DATABASEUSE
performace_schema--all-databases--skip-lock-tables
EVENT
--eventsCREATE EVENT
--ignore-error=error[,error]...
--force--force
--ignore-table=db_name.tbl_name
CREATE TABLE
SELECT
--routinesCREATE PROCEDURECREATE FUNCTION
--databases
--skip-triggers
TRIGGER
--where='where_condition'where_condition
WHERE
--where="user='jimf'" -w"userid>1" -w"userid<1"
INSERTInnoDB
ANALYZE TABLE
INSERTtbl_nametbl_name
INSERT
INSERT
IGNOREINSERT
--add-drop-table--add-locks--create-options--disable-keys--extended-insert--lock-tables--quick--set-charset
--opt--skip-optmysqldump
--opt
LOCK
TABLESUNLOCK
TABLES
RELOAD--all-databases--lock-all-tables--master-data--single-transactionFLUSH TABLES WITH READ LOCK--lock-all-tables--master-data--single-transaction
FLUSH PRIVILEGESmysql
--flush-privileges
--single-transaction--lock-tables
READ LOCALInnoDB--single-transaction
--lock-tables
--opt--skip-lock-tables
MyISAM
--shared-memory-base-name=name
MYSQL
--shared-memory
REPEATABLE READSTART
TRANSACTIONSTART
TRANSACTION
InnoDBMEMORY
--single-transactionALTER TABLECREATE TABLEDROP TABLERENAME TABLETRUNCATE TABLESELECT
--single-transaction--lock-tablesLOCK
TABLES
--single-transaction--quick
--disable-keys--lock-tables--skip-opt--skip-opt
shell> mysqldump db_name > backup-file.sql
shell> mysql db_name < backup-file.sql
shell> mysql -e "source /path-to-backup/backup-file.sql" db_name
shell> mysqldump --opt db_name | mysql --host=remote_host -C db_name
shell> mysqldump --databases db_name1 [db_name2 ...] > my_databases.sql
--all-databases
内核> mysqldump --all-databases > all_databases.sql
InnoDB
shell> mysqldump --all-databases --master-data --single-transaction > all_databases.sql
FLUSH TABLES WITH READ LOCKFLUSH
shell> mysqldump --all-databases --master-data=2 > all_databases.sql
shell>mysqldump --all-databases --flush-logs --master-data=2> all_databases.sql
--master-data--single-transaction
--opt--opt--skip-extended-insert--skip-quick--skip-extended-insert--skip-quick--opt
--opt--skip-opt--disable-keys--lock-tables
performance_schema--databases--skip-lock-tables
INFORMATION_SCHEMA
general_logmysql
LOAD DATA
INFILELOAD DATA
INFILE
shell> mysqlimport [options] db_name textfile1 [textfile2 ...]
patient.txtpatient
[mysqlimport]
--help
--columns=column_listcolumn_list
--debug[=debug_options]debug_options
debug_optionsfile_name
--default-character-set=charset_name
charset_name
--defaults-extra-file=file_name
file_name
file_name
--defaults-file
str[client]--defaults-group-suffix=_other[client_other]
--delete
mysql_clear_password
--fields-terminated-by=...--fields-enclosed-by=...--fields-optionally-enclosed-by=...--fields-escaped-by=...
LOAD
DATA INFILE
--force
--force
caching_sha2_password
--server-public-key-path=file_name--get-server-public-key
caching_sha2_password
--host=host_namehost_name
localhost
--ignore
--replace
N
LOAD DATA
INFILE--lines-terminated-by="\r\n"
--local
.mylogin.cnf
LOW_PRIORITYMEMORY
--no-defaults
.mylogin.cnf--no-defaults
--password[=password]password
-ppassword--password
--pipe
--default-auth
--port=port_numport_num
--protocol={TCP|SOCKET|PIPE|MEMORY}
--replace--ignore--replace--ignore
--server-public-key-path=file_name
sha256_password
--server-public-key-path=file_name--get-server-public-key
sha256_password
sha256_password
--shared-memory-base-name=name
MYSQL
--shared-memory
--silent
--socket=pathpath
localhost
--ssl
--ssl-fips-mode={OFF|ON|STRICT}
--ssl-fips-modexxx
--ssl-fips-mode
OFF
ON
STRICT
--ssl-fips-mode--ssl-fips-modeSTRICT
--user=user_nameuser_name
N
shell>mysql -e 'CREATE TABLE imptest(id INT, n VARCHAR(30))' testshell>eda 100 Max Sydow 101 Count Dracula . w imptest.txt 32 q shell>od -c imptest.txt0000000 1 0 0 \t M a x S y d o w \n 1 0 0000020 1 \t C o u n t D r a c u l a \n 0000040 shell>mysqlimport --local test imptest.txttest.imptest: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 shell>mysql -e 'SELECT * FROM imptest' test+------+---------------+ | id | n | +------+---------------+ | 100 | Max Sydow | | 101 | Count Dracula | +------+---------------+
CREATE USERGRANT
InnoDB
SELECTSHOW VIEWTRIGGERLOCK TABLES--single-transactionSELECT
CREATE
shell> mysqlpump [options] > dump.sql
--result-file
内核> mysqlpump [options] --result-file=dump.sql
--all-databases
内核> mysqlpump --all-databases
shell>mysqlpumpshell>db_namemysqlpumpdb_name tbl_name1 tbl_name2 ...
--databases
内核> mysqlpump --databasesdb_name1 db_name2...
mysqlCREATE USERGRANT--users
内核> mysqlpump --exclude-databases=% --users
%--exclude-databases
shell>mysqlpump [options] > dump.sqlshell>mysql < dump.sql
[mysqlpump]
| Add SET TIME_ZONE='+00:00' to dump file | |||
--help
DROP DATABASECREATE
DATABASE
DROP TABLECREATE TABLE
DROP USERCREATE USER
LOCK
TABLESUNLOCK
TABLES
INSERTUNLOCK
TABLES
--all-databases--databases
--routines--events--all-databasesmysql.procmysql.event--all-databases--routines--events
ANALYZE TABLE
INSERT
LZ4
--compress-output=LZ4--compress-output=ZLIB
CREATE DATABASE
--debug[=debug_options]debug_options
debug_optionsfile_name
--default-character-set=charset_name
charset_nameutf8
--parallel-schemas
--default-parallelism=0--parallel-schemas
--defaults-extra-file=file_name
file_name
file_name
--defaults-file
str[client]--defaults-group-suffix=_other[client_other]
InnoDB
--skip-defer-table-indexes
EVENT
--eventsCREATE EVENT
--skip-events
db_list
event_list
--exclude-routines=routine_list
routine_list
table_list
--exclude-triggers=trigger_list
trigger_list
user_list
INSERT
caching_sha2_password
--server-public-key-path=file_name--get-server-public-key
caching_sha2_password
'abc'BINARYVARBINARYBLOBBIT
--host=host_namehost_name
db_list
event_list
--include-routines=routine_list
routine_list
table_list
--include-triggers=trigger_list
trigger_list
user_list
INSERT
IGNOREINSERT
.mylogin.cnf
INSERT--extended-insertNnet_buffer_length
CREATE DATABASE
CREATE TABLE
--no-defaults
.mylogin.cnf--no-defaults
--parallel-schemas=[N:]db_list
db_listNNN--default-parallelism
--parallel-schemas
--password[=password]password
-ppassword-p
--default-auth
--port=port_numport_num
--protocol={TCP|SOCKET|PIPE|MEMORY}
\n
SELECT
--routinesCREATE PROCEDURECREATE FUNCTION
--skip-routines
--server-public-key-path=file_name
sha256_password
--server-public-key-path=file_name--get-server-public-key
sha256_password
sha256_password
SET NAMES
default_character_set
SET NAMES--skip-set-charset
SET
@@global.gtid_purged
AUTO
OFF | SET |
ON | SET |
AUTO | SET |
--set-gtid-purged
--set-gtid-purged=OFFSET @@SESSION.SQL_LOG_BIN=0;
--set-gtid-purged=ONSET @@SESSION.SQL_LOG_BIN=0;
--set-gtid-purged=AUTOSET @@SESSION.SQL_LOG_BIN=0;AUTO
REPEATABLE READSTART
TRANSACTIONSTART
TRANSACTION
InnoDBMEMORY
--single-transactionALTER TABLECREATE TABLEDROP TABLERENAME TABLETRUNCATE TABLESELECT
DEFINERCREATESQL
SECURITY
--socket={file_name|pipe_name}file_namepipe_name
localhost
--ssl
--ssl-fips-mode={OFF|ON|STRICT}
--ssl-fips-modexxx
--ssl-fips-mode
OFF
ON
STRICT
--ssl-fips-mode--ssl-fips-modeSTRICT
--skip-triggers
TIMESTAMPSET
TIME_ZONE='+00:00'TIMESTAMP--tz-utc
--skip-tz-utc
--user=user_nameuser_name
CREATE USERGRANT
mysqlmysql--users
内核> mysqlpump --exclude-databases=% --users
--skip-watch-progress
--include-databases--exclude-databases
--include-tables--exclude-tables
--include-routines--exclude-routines
--include-events--exclude-events
--include-users--exclude-users
--exclude-databases=test,world --include-tables=customer,invoice
%
_
--include-tables=t%,__tmptmp
%u1@%
db1db1.t1
shell> mysqlpump --include-databases=db1,db2 --exclude-tables=db1.t1,db2.t2
--all-databases
--include-databases=%--all-databases--all-databases
--databases--include-databases
--default-parallelism=NN
--parallel-schemas=[N:]db_listdb_listdb_listNN--default-parallelism
--parallel-schemas
%
--parallel-schemas
INSERTUSE
shell> mysqlpump --parallel-schemas=db1,db2 --parallel-schemas=db3
db1db3
内核> mysqlpump --parallel-schemas=db1,db2 --parallel-schemas=db3--default-parallelism=4
shell> mysqlpump --parallel-schemas=5:db1,db2 --parallel-schemas=3:db3
db1db3
--default-parallelism=0--parallel-schemas
performance_schemasys--databases--include-databases
INFORMATION_SCHEMA
CREATE USERGRANT--include-users--usersusertables_privprocs_privmysql
内核> mysqlpump mysql user db ...
SHOW
shell> mysqlshow [options] [db_name [tbl_name [col_name]]]
*%*%_%
[mysqlshow]
--help
MyISAM
--debug[=debug_options]debug_options
debug_optionsfile_name
--default-character-set=charset_name
charset_name
--defaults-extra-file=file_name
file_name
file_name
--defaults-file
str[client]--defaults-group-suffix=_other[client_other]
mysql_clear_password
caching_sha2_password
--server-public-key-path=file_name--get-server-public-key
caching_sha2_password
--host=host_namehost_name
--keys
.mylogin.cnf
--no-defaults
.mylogin.cnf--no-defaults
--password[=password]password
-ppassword--password
--pipe
--default-auth
--port=port_numport_num
--protocol={TCP|SOCKET|PIPE|MEMORY}
--server-public-key-path=file_name
sha256_password
--server-public-key-path=file_name--get-server-public-key
sha256_password
sha256_password
--shared-memory-base-name=name
MYSQL
--shared-memory
SHOW FULL
TABLESVIEW
--socket=pathpath
localhost
--ssl
--ssl-fips-mode={OFF|ON|STRICT}
--ssl-fips-modexxx
--ssl-fips-mode
OFF
ON
STRICT
--ssl-fips-mode--ssl-fips-modeSTRICT
--status
--user=user_nameuser_name
shell> mysqlslap [options]
--create--query--delimiter
mysqlslap --delimiter=";" --create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)" --query="SELECT * FROM a" --concurrency=50 --iterations=200
INTVARCHAR
mysqlslap --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql
create.sql';'';'
mysqlslap --concurrency=5 --iterations=5 --query=query.sql --create=create.sql --delimiter=";"
[mysqlslap]
--help
--auto-generate-sql-add-autoincrement
AUTO_INCREMENT
--auto-generate-sql-execute-number=N
--auto-generate-sql-guid-primary
--auto-generate-sql-load-type=type
readkeymixed
--auto-generate-sql-secondary-indexes=N
--auto-generate-sql-unique-query-number=N
key
--auto-generate-sql-unique-write-number=N
--auto-generate-sql-write-number
--auto-generate-sql-write-number=N
--auto-generate-sql--no-drop
--debug[=debug_options]debug_options
debug_optionsfile_name
--defaults-extra-file=file_name
file_name
file_name
--defaults-file
str[client]--defaults-group-suffix=_other[client_other]
--delimiter=strstr
N
mysql_clear_password
--engine=engine_nameengine_name
caching_sha2_password
--server-public-key-path=file_name--get-server-public-key
caching_sha2_password
--host=host_namehost_name
.mylogin.cnf
--no-defaults
.mylogin.cnf--no-defaults
VARCHAR--auto-generate-sql
INT--auto-generate-sql
;
内核> mysqlslap --delimiter=";" --number-of-queries=10--query="use test;insert into t values(null)"
--password[=password]password
-ppassword--password
--pipe
--default-auth
--port=port_numport_num
system()
system()
--protocol={TCP|SOCKET|PIPE|MEMORY}
--query=valuevalue
SELECT
--server-public-key-path=file_name
sha256_password
--server-public-key-path=file_name--get-server-public-key
sha256_password
sha256_password
--shared-memory-base-name=name
--silent
--socket=pathpath
localhost
--ssl
--ssl-fips-mode={OFF|ON|STRICT}
--ssl-fips-modexxx
--ssl-fips-mode
OFF
ON
STRICT
--ssl-fips-mode--ssl-fips-modeSTRICT
--user=user_nameuser_name
InnoDB
*.ibd*.ibdibdata*
ROLLBACK
shell> ibd2sdi [options] file_name1 [file_name2 file_name3 ...]
InnoDB
内核> ibd2sdi ibdata1 ibdata2
JSON
--help
shell> ibd2sdi --help
Usage: ./ibd2sdi [-v] [-c <strict-check>] [-d <dump file name>] [-n] filename1 [filenames]
See http://dev.mysql.com/doc/refman/8.0/en/ibd2sdi.html for usage hints.
-h, --help Display this help and exit.
-v, --version Display version information and exit.
-#, --debug[=name] Output debug log. See
http://dev.mysql.com/doc/refman/8.0/en/dbug-package.html
-d, --dump-file=name
Dump the tablespace SDI into the file passed by user.
Without the filename, it will default to stdout
-s, --skip-data Skip retrieving data from SDI records. Retrieve only id
and type.
-i, --id=# Retrieve the SDI record matching the id passed by user.
-t, --type=# Retrieve the SDI records matching the type passed by
user.
-c, --strict-check=name
Specify the strict checksum algorithm by the user.
Allowed values are innodb, crc32, none.
-n, --no-check Ignore the checksum verification.
-p, --pretty Pretty format the SDI output.If false, SDI would be not
human readable but it will be of less size
(Defaults to on; use --skip-pretty to disable.)
Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
--------------------------------- ----------------------------------------
debug (No default value)
dump-file (No default value)
skip-data FALSE
id 0
type 0
strict-check crc32
no-check FALSE
pretty TRUE
shell> ibd2sdi --version
ibd2sdi Ver 8.0.3-dmr for Linux on x86_64 (Source distribution)
--debug[=debug_options]debug_options
shell> ibd2sdi --debug=d:t /tmp/ibd2sdi.trace
stdout
内核> ibd2sdi --dump-file=file_name../data/test/t1.ibd
datatype
内核> ibd2sdi --skip-data ../data/test/t1.ibd[“ibd2sdi”,{“类型”:1、“身份证”:330 },{“2型”、“身份证”:7)]
--id=##
idmysql.tablespace
shell> ibd2sdi --id=7 ../data/test/t1.ibd
["ibd2sdi"
,
{
"type": 2,
"id": 7,
"object":
{
"mysqld_version_id": 80003,
"dd_version": 80003,
"sdi_version": 1,
"dd_object_type": "Tablespace",
"dd_object": {
"name": "test/t1",
"comment": "",
"options": "",
"se_private_data": "flags=16417;id=2;server_version=80003;space_version=1;",
"engine": "InnoDB",
"files": [
{
"ordinal_position": 1,
"filename": "./test/t1.ibd",
"se_private_data": "id=2;"
}
]
}
}
}
]
--type=##
Retrieves serialized dictionary information (SDI) matching the specified object type. SDI is provided for table (type=1) and tablespace (type=2) objects.
shell> ibd2sdi --type=2 ../data/test/t1.ibd
["ibd2sdi"
,
{
"type": 2,
"id": 7,
"object":
{
"mysqld_version_id": 80003,
"dd_version": 80003,
"sdi_version": 1,
"dd_object_type": "Tablespace",
"dd_object": {
"name": "test/t1",
"comment": "",
"options": "",
"se_private_data": "flags=16417;id=2;server_version=80003;space_version=1;",
"engine": "InnoDB",
"files": [
{
"ordinal_position": 1,
"filename": "./test/t1.ibd",
"se_private_data": "id=2;"
}
]
}
}
}
]
innodbnone
innodb
内核> ibd2sdi --strict-check=innodb ../data/test/t1.ibd
crc32
内核> ibd2sdi -c crc32 ../data/test/t1.ibd
--strict-checkcrc32
shell> ibd2sdi --no-check ../data/test/t1.ibd
--pretty
--skip-pretty
内核> ibd2sdi --skip-pretty ../data/test/t1.ibd
InnoDBInnoDB
CHECK TABLE
shell> innochecksum [options] file_name
--help
shell> innochecksum --help
--info
--help
内核> innochecksum --info
shell> innochecksum --version
--log option
shell> innochecksum --verbose
shell> innochecksum --verbose=FALSE
--verbose
shell> innochecksum --verbose --log=/var/lib/mysql/test/logtest.txt
shell> cat ./logtest.txt | grep -i "okay"
page 1663 okay: 2.863% done page 8447 okay: 14.537% done page 13695 okay: 23.568% done page 18815 okay: 32.379% done page 23039 okay: 39.648% done page 28351 okay: 48.789% done page 33023 okay: 56.828% done page 37951 okay: 65.308% done page 44095 okay: 75.881% done page 49407 okay: 85.022% done page 54463 okay: 93.722% done ...
--count
shell> innochecksum --count ../data/test/tab1.ibd
--start-page=numnum
shell> innochecksum --start-page=600 ../data/test/tab1.ibd
shell> innochecksum -s 600 ../data/test/tab1.ibd
--end-page=numnum
shell> innochecksum --end-page=700 ../data/test/tab1.ibd
shell> innochecksum --p 700 ../data/test/tab1.ibd
--page=numnum
shell> innochecksum --page=701 ../data/test/tab1.ibd
innodbnone
innodb
内核> innochecksum --strict-check=innodb ../data/test/tab1.ibd
crc32
内核> innochecksum -C crc32 ../data/test/tab1.ibd
--strict-checkinnodbnone
none
innodb
crc32
--write--write
innodb
内核> innochecksum --no-check --write innodb ../data/test/tab1.ibd
--allow-mismatches=NN>=0NN+1
innodb
shell> innochecksum --allow-mismatches=1 --write innodb ../data/test/tab1.ibd
--allow-mismatches
--write=namenum
--no-check--no-check--no-check
--write
innodb
crc32
none
--write
--write
crc32
shell> innochecksum -w crc32 ../data/test/tab1.ibd
crc32
shell> innochecksum --no-check --write crc32 ../data/test/tab1.ibd
shell> innochecksum --page-type-summary ../data/test/tab1.ibd
--page-type-summary
File::../data/test/tab1.ibd================PAGE TYPE SUMMARY==============#PAGE_COUNT PAGE_TYPE=============================================== 2 Index page 0 Undo log page 1 Inode page 0 Insert buffer free list page 2 Freshly allocated page 1 Insert buffer bitmap 0 System page 0 Transaction system page 1 File Space Header 0 Extent descriptor page 0 BLOB page 0 Compressed BLOB page 0 Other type of page===============================================Additional information:Undo page type: 0 insert, 0 update, 0 otherUndo page state: 0 active, 0 cached, 0 to_free, 0 to_purge, 0 prepared, 0 other
stderr
shell> innochecksum --page-type-dump=/tmp/a.txt ../data/test/tab1.ibd
--log
--log
shell> innochecksum --log=/tmp/log.txt ../data/test/tab1.ibd
shell> innochecksum -l /tmp/log.txt ../data/test/tab1.ibd
-
shell> cat t1.ibd | innochecksum -
crc32t1.ibd
内核> cat t1.ibd | innochecksum --write=crc32 - > a.ibd
.ibd
.ibd
shell> innochecksum ./data/test/*.ibd
.ibd
shell> innochecksum ./data/test/t*.ibd
.ibd
shell> innochecksum ./data/*/*.ibd
cmd> innochecksum.exe t1.ibd cmd> innochecksum.exe t2.ibd cmd> innochecksum.exe t3.ibd
InnoDBinnodb_data_file_pathinnodb_data_file_pathibdata2
shell> ./bin/mysqld --no-defaults --innodb-data-file-path="ibdata1:10M;ibdata2:10M;ibdata3:10M:autoextend"
ibdata1ibdata3-
shell> cat ibdata* | innochecksum -
cmd> innochecksum.exe ibdata1 cmd> innochecksum.exe ibdata2 cmd> innochecksum.exe ibdata3
FULLTEXTMyISAMFLUSH TABLES
shell> myisam_ftdump [options] tbl_name index_num
tbl_name.MYI
test
CREATE TABLE mytexttable ( id INT NOT NULL, txt TEXT NOT NULL, PRIMARY KEY (id), FULLTEXT (txt) ) ENGINE=MyISAM;
idtxt
shell> myisam_ftdump mytexttable 1
test
shell> myisam_ftdump /usr/local/mysql/data/test/mytexttable 1
shell> myisam_ftdump -c mytexttable 1 | sort -r
shell> myisam_ftdump -c mytexttable 1 | sort /R
MyISAM.MYI
CHECK TABLEREPAIR TABLE
shell> myisamchk [options] tbl_name ...
options
tbl_name
.MYIMyISAM
内核> myisamchk *.MYI
shell> myisamchk /path/to/database_dir/*.MYI
shell> myisamchk /path/to/datadir/*/*.MYI
MyISAM
内核> myisamchk --silent --fast/path/to/datadir/*/*.MYI
MyISAM
内核> myisamchk --silent --force --fast --update-state \--key_buffer_size=64M --myisam_sort_buffer_size=64M \--read_buffer_size=1M --write_buffer_size=1M \/path/to/datadir/*/*.MYI
warning: clients are using or haven't closed the table properly
MyISAM
FLUSH TABLES
CHECK TABLE
[myisamchk]
--help
--HELP
--debug=debug_optionsdebug_options
debug_optionsfile_name
--defaults-extra-file=file_name
file_name
file_name
str[myisamchk]--defaults-group-suffix=_other[myisamchk_other]
--no-defaults
.mylogin.cnf--no-defaults
--silent
-s
-d-v-vvv
--wait
--var_name=value
decode_bits | |
ft_max_word_len | |
ft_min_word_len | |
ft_stopword_file | |
key_buffer_size | |
myisam_block_size | |
myisam_sort_key_blocks | |
read_buffer_size | |
sort_buffer_size | |
sort_key_blocks | |
stats_method | |
write_buffer_size |
myisam_sort_buffer_size--recovermyisam_sort_buffer_size
key_buffer_size--extend-check
CHARVARCHARTEXT--sort-recover
key_buffer_size
myisam_block_size
stats_method--analyzemyisam_stats_method
ft_min_word_lenFULLTEXTft_stopword_file
FULLTEXT
MyISAMft_max_word_len
shell> myisamchk --recover --ft_min_word_len=3 tbl_name.MYI
[mysqld]
[mysqld] ft_min_word_len=3 [myisamchk] ft_min_word_len=3
REPAIR TABLEANALYZE TABLEOPTIMIZE TABLEALTER TABLE
--check
--extend-check
--fast
--force
--extend-check
.MYI--check-only-changed
--recover--safe-recover
--backup
.MYDfile_nametime
--force
tbl_name.TMD
--keys-used=valval
-r
--quick
MyISAM--safe-recover--recover--recover
myisam_sort_buffer_size
--recover--recover--recover--recover--safe-recover--recover
key_buffer_size
--tmpdir=dir_namedir_name
TMPDIR--tmpdir;
--unpack
--analyze
tbl_nametbl_name
--block-search=offsetoffset
--verbose
--set-auto-increment[=value]value
AUTO_INCREMENTvalue
SELECTSHOW INDEX
PACK_KEYS=0PACK_KEYS=1
MyISAM
tbl_nametbl_name
person
CREATE TABLE person ( id INT NOT NULL AUTO_INCREMENT, last_name VARCHAR(20) NOT NULL, first_name VARCHAR(20) NOT NULL, birth DATE, death DATE, PRIMARY KEY (id), INDEX (last_name, first_name), INDEX (birth) ) MAX_ROWS = 1000000 ENGINE=MYISAM;
-rw-rw---- 1 mysql mysql 9347072 Aug 19 11:47 person.MYD -rw-rw---- 1 mysql mysql 6066176 Aug 19 11:47 person.MYI
MyISAM file: person
Record format: Packed
Character set: utf8mb4_0900_ai_ci (255)
File-version: 1
Creation time: 2017-03-30 21:21:30
Status: checked,analyzed,optimized keys,sorted index pages
Auto increment key: 1 Last value: 306688
Data records: 306688 Deleted blocks: 0
Datafile parts: 306688 Deleted data: 0
Datafile pointer (bytes): 4 Keyfile pointer (bytes): 3
Datafile length: 9347072 Keyfile length: 6066176
Max datafile length: 4294967294 Max keyfile length: 17179868159
Recordlength: 54
table description:
Key Start Len Index Type Rec/key Root Blocksize
1 2 4 unique long 1 1024
2 6 80 multip. varchar prefix 0 1024
87 80 varchar 0
3 168 3 multip. uint24 NULL 0 1024
Field Start Length Nullpos Nullbit Type
1 1 1
2 2 4 no zeros
3 6 81 varchar
4 87 81 varchar
5 168 3 1 1 no zeros
6 171 3 1 2 no zeros
MyISAM file
MyISAM
Record format
Fixed lengthPackedSHOW TABLE STATUS
Chararacter set
File-version
MyISAM
Creation time
Recover time
Status
crashedchangedoptimized keys
Auto increment key
AUTO_INCREMENT
Data records
Deleted blocks
Datafile parts
Data records
Deleted data
Datafile pointer
Keyfile pointer
Max datafile length
Max keyfile length
Recordlength
table description
Key
table description
Start
Len
Len
Index
unique
Type
MyISAMstripped
Root
Blocksize
Rec/key
Field
Start
Length
Nullpos
NULLNULLNullbit
NULLperson
Type
constant
no endspace
no endspace, not_always
no endspace, no empty
table-lookup
ENUM
zerofill(N)
N
no zeros
always zero
Huff tree
Bits
Huff tree
Checking MyISAM file: person
Data records: 306688 Deleted blocks: 0
- check file-size
- check record delete-chain
No recordlinks
- check key delete-chain
block_size 1024:
- check index reference
- check data record references index: 1
Key: 1: Keyblocks used: 98% Packed: 0% Max levels: 3
- check data record references index: 2
Key: 2: Keyblocks used: 99% Packed: 97% Max levels: 3
- check data record references index: 3
Key: 3: Keyblocks used: 98% Packed: -14% Max levels: 3
Total: Keyblocks used: 98% Packed: 89%
- check records and index references
*** LOTS OF ROW NUMBERS DELETED ***
Records: 306688 M.recordlength: 25 Packed: 83%
Recordspace used: 97% Empty space: 2% Blocks/Record: 1.00
Record blocks: 306688 Delete blocks: 0
Record data: 7934464 Deleted data: 0
Lost space: 256512 Linkdata: 1156096
User time 43.08, System time 1.68
Maximum resident set size 0, Integral resident set size 0
Non-physical pagefaults 0, Physical pagefaults 0, Swaps 0
Blocks in 0 out 7, Messages in 0 out 0, Signals 0
Voluntary context switches 0, Involuntary context switches 0
Maximum memory usage: 1046926 bytes (1023k)
Data records
Deleted blocks
Key
Keyblocks used
Packed
CHARVARCHAR
Max levels
Records
M.recordlength
Packed
Packed
Recordspace used
Empty space
Blocks/Record
Recordblocks
Deleteblocks
Recorddata
Deleted data
Lost space
Linkdata
Linkdata
shell>myisamchk --myisam_sort_buffer_size=256M \--key_buffer_size=512M \--read_buffer_size=64M \--write_buffer_size=64M ...
--myisam_sort_buffer_size=16M
TMPDIR--tmpdir=dir_name
--quick
--recover--sort-recover--safe-recover--tmpdir=dir_name
( largest_keyrow_pointer_length)* number_of_rows* 2
row_pointer_lengthtbl_namerow_pointer_lengthnumber_of_rowsData
recordslargest_keyLen
--safe-recover--recover
MyISAM--log-isam=log_file
shell> myisamlog [options] [file_name [tbl_name] ...]
-umyisam.loglog_file
MyISAM
mmap()
shell> myisampack [options] file_name ...
.MYI
--help
--backup
tbl_name.OLD
--debug[=debug_options]debug_options
debug_optionsfile_name
--force
tbl_name.TMD.TMDtbl_name.TMD--force
--join=big_tbl_namebig_tbl_name
big_tbl_name
big_tbl_namebig_tbl_name
--silent
--test
--tmpdir=dir_namedir_name
--wait
shell>ls -l station.*-rw-rw-r-- 1 monty my 994128 Apr 17 19:00 station.MYD -rw-rw-r-- 1 monty my 53248 Apr 17 19:00 station.MYI shell>myisamchk -dvv stationMyISAM file: station Isam-version: 2 Creation time: 1996-03-13 10:08:58 Recover time: 1997-02-02 3:06:43 Data records: 1192 Deleted blocks: 0 Datafile parts: 1192 Deleted data: 0 Datafile pointer (bytes): 2 Keyfile pointer (bytes): 2 Max datafile length: 54657023 Max keyfile length: 33554431 Recordlength: 834 Record format: Fixed length table description: Key Start Len Index Type Root Blocksize Rec/key 1 2 4 unique unsigned long 1024 1024 1 2 32 30 multip. text 10240 1024 1 Field Start Length Type 1 1 1 2 2 4 3 6 4 4 10 1 5 11 20 6 31 1 7 32 30 8 62 35 9 97 35 10 132 35 11 167 4 12 171 16 13 187 35 14 222 4 15 226 16 16 242 20 17 262 20 18 282 20 19 302 30 20 332 4 21 336 4 22 340 1 23 341 8 24 349 8 25 357 8 26 365 2 27 367 2 28 369 4 29 373 4 30 377 1 31 378 2 32 380 8 33 388 4 34 392 4 35 396 4 36 400 4 37 404 1 38 405 4 39 409 4 40 413 4 41 417 4 42 421 4 43 425 4 44 429 20 45 449 30 46 479 1 47 480 1 48 481 79 49 560 79 50 639 79 51 718 79 52 797 8 53 805 1 54 806 1 55 807 20 56 827 4 57 831 4 shell>myisampack station.MYICompressing station.MYI: (1192 records) - Calculating statistics normal: 20 empty-space: 16 empty-zero: 12 empty-fill: 11 pre-space: 0 end-space: 12 table-lookups: 5 zero: 7 Original trees: 57 After join: 17 - Compressing file 87.14% Remember to run myisamchk -rq on compressed tables shell>myisamchk -rq station- check record delete-chain - recovering (with sort) MyISAM-table 'station' Data records: 1192 - Fixing index 1 - Fixing index 2 shell>mysqladmin -uroot flush-tablesshell>ls -l station.*-rw-rw-r-- 1 monty my 127874 Apr 17 19:00 station.MYD -rw-rw-r-- 1 monty my 55296 Apr 17 19:04 station.MYI shell>myisamchk -dvv stationMyISAM file: station Isam-version: 2 Creation time: 1996-03-13 10:08:58 Recover time: 1997-04-17 19:04:26 Data records: 1192 Deleted blocks: 0 Datafile parts: 1192 Deleted data: 0 Datafile pointer (bytes): 3 Keyfile pointer (bytes): 1 Max datafile length: 16777215 Max keyfile length: 131071 Recordlength: 834 Record format: Compressed table description: Key Start Len Index Type Root Blocksize Rec/key 1 2 4 unique unsigned long 10240 1024 1 2 32 30 multip. text 54272 1024 1 Field Start Length Type Huff tree Bits 1 1 1 constant 1 0 2 2 4 zerofill(1) 2 9 3 6 4 no zeros, zerofill(1) 2 9 4 10 1 3 9 5 11 20 table-lookup 4 0 6 31 1 3 9 7 32 30 no endspace, not_always 5 9 8 62 35 no endspace, not_always, no empty 6 9 9 97 35 no empty 7 9 10 132 35 no endspace, not_always, no empty 6 9 11 167 4 zerofill(1) 2 9 12 171 16 no endspace, not_always, no empty 5 9 13 187 35 no endspace, not_always, no empty 6 9 14 222 4 zerofill(1) 2 9 15 226 16 no endspace, not_always, no empty 5 9 16 242 20 no endspace, not_always 8 9 17 262 20 no endspace, no empty 8 9 18 282 20 no endspace, no empty 5 9 19 302 30 no endspace, no empty 6 9 20 332 4 always zero 2 9 21 336 4 always zero 2 9 22 340 1 3 9 23 341 8 table-lookup 9 0 24 349 8 table-lookup 10 0 25 357 8 always zero 2 9 26 365 2 2 9 27 367 2 no zeros, zerofill(1) 2 9 28 369 4 no zeros, zerofill(1) 2 9 29 373 4 table-lookup 11 0 30 377 1 3 9 31 378 2 no zeros, zerofill(1) 2 9 32 380 8 no zeros 2 9 33 388 4 always zero 2 9 34 392 4 table-lookup 12 0 35 396 4 no zeros, zerofill(1) 13 9 36 400 4 no zeros, zerofill(1) 2 9 37 404 1 2 9 38 405 4 no zeros 2 9 39 409 4 always zero 2 9 40 413 4 no zeros 2 9 41 417 4 always zero 2 9 42 421 4 no zeros 2 9 43 425 4 always zero 2 9 44 429 20 no empty 3 9 45 449 30 no empty 3 9 46 479 1 14 4 47 480 1 14 4 48 481 79 no endspace, no empty 15 9 49 560 79 no empty 2 9 50 639 79 no empty 2 9 51 718 79 no endspace 16 9 52 797 8 no empty 2 9 53 805 1 17 1 54 806 1 3 9 55 807 20 no empty 3 9 56 827 4 no zeros, zerofill(2) 2 9 57 831 4 no zeros, zerofill(1) 2 9
normal
empty-space
empty-zero
empty-fill
BIGINTTINYINT127
pre-space
end-space
table-lookup
ENUM
zero
Original trees
After join
Field
Type
constant
no endspace
no endspace, not_always
no endspace, no empty
table-lookup
ENUM
zerofill(N)
N
no zeros
always zero
Huff tree
Bits
shell> myisamchk -rq --sort-index --analyze tbl_name.MYI
.mylogin.cnf
.mylogin.cnfhostpasswordsocket
[client]user = mydefaultnamepassword = mydefaultpasshost = 127.0.0.1[mypath]user = myothernamepassword = myotherpasshost = localhost
.mylogin.cnf
MYSQL_TEST_LOGIN_FILE
client--login-path=name
--login-path
内核> mysql
[client]
--login-path
内核> mysql --login-path=mypath
[client][client][mypath]
--no-defaults--no-defaults
.mylogin.cnfprint
.mylogin.cnf.mylogin.cnf
shell> mysql_config_editor [program_options] command [command_options]
program_options
commandsetprint
command_options
shell>mysql_config_editor --help setshell>mysql_config_editor set --help
set
clientremote.example.com
localuser
remoteuser
.mylogin.cnf
shell>mysql_config_editor set --login-path=client --host=localhost --user=localuser --passwordEnter password:enter password "localpass" hereshell>mysql_config_editor set --login-path=remote --host=remote.example.com --user=remoteuser --passwordEnter password:enter password "remotepass" here
client--login-path=client
.mylogin.cnf
shell> mysql_config_editor print --all
[client]
user = localuser
password = *****
host = localhost
[remote]
user = remoteuser
password = *****
host = remote.example.com
print
--all--login-path=nameclient
--login-path
内核> mysql --login-path=remote
[client][client][remote]
shell> mysql --login-path=client
client--login-path
内核> mysql
clientclientclient
setremote
shell> mysql --login-path=remote --host=remote2.example.com
--help
command
shell> mysql_config_editor command --help
--debug[=debug_options]debug_options
debug_optionsfile_name
help
command
shell> mysql_config_editor command --help
print
[options]
*****
client--login-path
print
--help
print
--all
--login-path=namename
remove
[options]
--host--port--userusermypath
内核> mysql_config_editor remove --login-path=mypath --user
mypath
内核> mysql_config_editor remove --login-path=mypath
remove
--help
remove
--host
--login-path=namename
client
--password
--port
--socket
--user
--warn
client--login-path=client--skip-warn
reset
[options]
reset
--help
reset
set [options]
--host--port--user
set
--help
set
--host=host_namehost_name
--login-path=namename
client
--password
password =
--port=port_numport_num
--socket=file_namefile_name
--user=user_nameuser_name
--warn
--skip-warn
shell> mysqlbinlog [options] log_file ...
binlog.000003
内核> mysqlbinlog binlog.0000003
binlog.000003
# at 141 #100309 9:28:36 server id 123 end_log_pos 245 Query thread_id=3350 exec_time=11 error_code=0
at
server idserver_idthread_iderror_code
--read-from-remote-server--host--password--port--protocol--socket--user--read-from-remote-server
TMPDIR
[mysqlbinlog]
--help
BINLOG
AUTOBINLOG--base64-output--base64-output=AUTO
BINLOG
NEVERBINLOGBINLOG
DECODE-ROWS--verboseDECODE-ROWSBINLOG
--base64-output--verbose
--binlog-row-event-max-size=# | |
4294967040 | |
256 | |
18446744073709547520 |
--connection-server-id=server_id
--connection-server-id
--read-from-remote-server--stop-never--connection-server-id
--database=db_namedb_name
db_nameUSE
--database--binlog-do-db--database
--binlog-do-db
--database
db_namedb_name
db_namedb_name
CREATE
DATABASEALTER
DATABASEDROP
DATABASE
INSERT INTO test.t1 (i) VALUES(100); INSERT INTO db2.t2 (j) VALUES(200); USE test; INSERT INTO test.t1 (i) VALUES(101); INSERT INTO t1 (i) VALUES(102); INSERT INTO db2.t2 (j) VALUES(201); USE db2; INSERT INTO test.t1 (i) VALUES(103); INSERT INTO db2.t2 (j) VALUES(202); INSERT INTO t2 (j) VALUES(203);
mysqlbinlog --database=testINSERTINSERTUSE
testINSERTUSE db2
mysqlbinlog --database=db2INSERTINSERTUSE testINSERTUSE db2
db_namet1USE
binlog_format--databaseUSE
--rewrite-db--database
--debug[=debug_options]debug_options
debug_optionsfile_name
--defaults-extra-file=file_name
file_name
file_name
--defaults-file
str[client]--defaults-group-suffix=_other[client_other]
--to-last-log
SYSTEM_VARIABLES_ADMINSUPERSET
sql_log_bin = 0SETSYSTEM_VARIABLES_ADMINSUPER
gtid_set
caching_sha2_password
--server-public-key-path=file_name--get-server-public-key
caching_sha2_password
--host=host_namehost_name
gtid_set
--local-load=dir_namedir_name
LOAD DATA
INFILE
.mylogin.cnf
--no-defaults
.mylogin.cnf--no-defaults
--offset=NN
N
--password[=password]password
-ppassword--password
--default-auth
--port=port_numport_num
binlog-row-metadata
--protocol={TCP|SOCKET|PIPE|MEMORY}
--raw--read-from-remote-server--raw--stop-never--result-file
--read-from-remote-master=type
COM_BINLOG_DUMPBINLOG-DUMP-NON-GTIDS--read-from-remote-master=BINLOG-DUMP-GTIDS--exclude-gtids
--host--password--port--protocol--socket--user
--result-file=namename
--raw--raw--result-file
--rewrite-db='from_name->to_name'
from_nameto_nameUSE
'from_name->to_name'
shell> mysqlbinlog --rewrite-db='dbcurrent->dbold' --rewrite-db='dbtest->dbcurrent' \
binlog.00001 > /tmp/statements.sql
--database--database
--rewrite-db='mydb->yourdb'
--database=yourdbyourdb--rewrite-db='mydb->yourdb' --database=mydbmydb--database--database=mydb
--server-public-key-path=file_name
sha256_password
--server-public-key-path=file_name--get-server-public-key
sha256_password
sha256_password
SET NAMES
charset_name
--shared-memory-base-name=name
MYSQL
--shared-memory
shell>mysqlbinlog --skip-gtids binlog.000001 > /tmp/dump.sqlshell>mysqlbinlog --skip-gtids binlog.000002 >> /tmp/dump.sqlshell>mysql -u root -p -e "source /tmp/dump.sql"
--socket=pathpath
localhost
--ssl
--ssl-fips-mode={OFF|ON|STRICT}
--ssl-fips-modexxx
--ssl-fips-mode
OFF
ON
STRICT
--ssl-fips-mode--ssl-fips-modeSTRICT
datetimedatetimeDATETIMETIMESTAMP
内核> mysqlbinlog --start-datetime="2005-12-25 11:25:56" binlog.000003
N
datetime--start-datetimedatetime
--read-from-remote-server--stop-never--to-last-log
--stop-never--raw--raw
--stop-never--connection-server-id
--stop-never-slave-server-id=id
--connection-server-id
N
--read-from-remote-server
--user=user_nameuser_name
--base64-output--verbose
--var_name=value
shell> mysqlbinlog binlog.000001 | mysql -u root -p
shell> mysqlbinlog binlog.[0-9]* | mysql -u root -p
BLOB--binary-mode
shell>mysqlbinlog binlog.000001 > tmpfileshell> ...edit tmpfile... shell>mysql -u root -p < tmpfile
--start-position--stop-datetime
shell>mysqlbinlog binlog.000001 | mysql -u root -p # DANGER!!shell>mysqlbinlog binlog.000002 | mysql -u root -p # DANGER!!
CREATE TEMPORARY
TABLE
shell> mysqlbinlog binlog.000001 binlog.000002 | mysql -u root -p
shell>mysqlbinlog binlog.000001 > /tmp/statements.sqlshell>mysqlbinlog binlog.000002 >> /tmp/statements.sqlshell>mysql -u root -p -e "source /tmp/statements.sql"
binlog-files_1.gz
shell> gzip -cd binlog-files_1.gz | ./mysqlbinlog - | ./mysql -uroot -p
shell> gzip -cd binlog-files_1.gz binlog-files_2.gz | ./mysqlbinlog - | ./mysql -uroot -p
--stop-position
LOAD
DATA INFILELOAD DATA LOCAL
INFILE--local-load
LOAD DATA
INFILELOAD DATA LOCAL
INFILELOCAL
LOAD DATA
LOCALoriginal_file_name-#-#
--hexdump
shell> mysqlbinlog --hexdump master-bin.000001
#
/*!40019 SET @@session.max_insert_delayed_threads=0*/;/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;# at 4#051024 17:24:13 server id 1 end_log_pos 98# Position Timestamp Type Master ID Size Master Pos Flags# 00000004 9d fc 5c 43 0f 01 00 00 00 5e 00 00 00 62 00 00 00 00 00# 00000017 04 00 35 2e 30 2e 31 35 2d 64 65 62 75 67 2d 6c |..5.0.15.debug.l|# 00000027 6f 67 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |og..............|# 00000037 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|# 00000047 00 00 00 00 9d fc 5c 43 13 38 0d 00 08 00 12 00 |.......C.8......|# 00000057 04 04 04 04 12 00 00 4b 00 04 1a |.......K...|# Start: binlog v 4, server v 5.0.15-debug-log created 051024 17:24:13# at startupROLLBACK;
Position
Timestamp'051024 17:24:13'
Type
Master ID
Size
Master Pos
Flags
WRITE_ROWS_EVENTDELETE_ROWS_EVENT--base64-output=DECODE-ROWS--verbose
CREATE TABLE t ( id INT NOT NULL, name VARCHAR(20) NOT NULL, date DATE NULL ) ENGINE = InnoDB; START TRANSACTION; INSERT INTO t VALUES(1, 'apple', NULL); UPDATE t SET name = 'pear', date = '2009-01-01' WHERE id = 1; DELETE FROM t WHERE id = 1; COMMIT;
BINLOG
内核> mysqlbinlog...# at 218#080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_FBINLOG 'fAS3SBMBAAAALAAAANoAAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ=fAS3SBcBAAAAKAAAAAIBAAAQABEAAAAAAAEAA//8AQAAAAVhcHBsZQ=='/*!*/;...# at 302#080828 15:03:08 server id 1 end_log_pos 356 Update_rows: table id 17 flags: STMT_END_FBINLOG 'fAS3SBMBAAAALAAAAC4BAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ=fAS3SBgBAAAANgAAAGQBAAAQABEAAAAAAAEAA////AEAAAAFYXBwbGX4AQAAAARwZWFyIbIP'/*!*/;...# at 400#080828 15:03:08 server id 1 end_log_pos 442 Delete_rows: table id 17 flags: STMT_END_FBINLOG 'fAS3SBMBAAAALAAAAJABAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ=fAS3SBkBAAAAKgAAALoBAAAQABEAAAAAAAEAA//4AQAAAARwZWFyIbIP'/*!*/;log_file
--verbose###
内核> mysqlbinlog -v...# at 218#080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_FBINLOG 'fAS3SBMBAAAALAAAANoAAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ=fAS3SBcBAAAAKAAAAAIBAAAQABEAAAAAAAEAA//8AQAAAAVhcHBsZQ=='/*!*/;### INSERT INTO test.t### SET### @1=1### @2='apple'### @3=NULL...# at 302#080828 15:03:08 server id 1 end_log_pos 356 Update_rows: table id 17 flags: STMT_END_FBINLOG 'fAS3SBMBAAAALAAAAC4BAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ=fAS3SBgBAAAANgAAAGQBAAAQABEAAAAAAAEAA////AEAAAAFYXBwbGX4AQAAAARwZWFyIbIP'/*!*/;### UPDATE test.t### WHERE### @1=1### @2='apple'### @3=NULL### SET### @1=1### @2='pear'### @3='2009:01:01'...# at 400#080828 15:03:08 server id 1 end_log_pos 442 Delete_rows: table id 17 flags: STMT_END_FBINLOG 'fAS3SBMBAAAALAAAAJABAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ=fAS3SBkBAAAAKgAAALoBAAAQABEAAAAAAAEAA//4AQAAAARwZWFyIbIP'/*!*/;### DELETE FROM test.t### WHERE### @1=1### @2='pear'### @3='2009:01:01'log_file
--verbose
shell> mysqlbinlog -vv log_file
...
# at 218
#080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_F
BINLOG '
fAS3SBMBAAAALAAAANoAAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ=
fAS3SBcBAAAAKAAAAAIBAAAQABEAAAAAAAEAA//8AQAAAAVhcHBsZQ==
'/*!*/;
### INSERT INTO test.t
### SET
### @1=1 /* INT meta=0 nullable=0 is_null=0 */
### @2='apple' /* VARSTRING(20) meta=20 nullable=0 is_null=0 */
### @3=NULL /* VARSTRING(20) meta=0 nullable=1 is_null=1 */
...
# at 302
#080828 15:03:08 server id 1 end_log_pos 356 Update_rows: table id 17 flags: STMT_END_F
BINLOG '
fAS3SBMBAAAALAAAAC4BAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ=
fAS3SBgBAAAANgAAAGQBAAAQABEAAAAAAAEAA////AEAAAAFYXBwbGX4AQAAAARwZWFyIbIP
'/*!*/;
### UPDATE test.t
### WHERE
### @1=1 /* INT meta=0 nullable=0 is_null=0 */
### @2='apple' /* VARSTRING(20) meta=20 nullable=0 is_null=0 */
### @3=NULL /* VARSTRING(20) meta=0 nullable=1 is_null=1 */
### SET
### @1=1 /* INT meta=0 nullable=0 is_null=0 */
### @2='pear' /* VARSTRING(20) meta=20 nullable=0 is_null=0 */
### @3='2009:01:01' /* DATE meta=0 nullable=1 is_null=0 */
...
# at 400
#080828 15:03:08 server id 1 end_log_pos 442 Delete_rows: table id 17 flags: STMT_END_F
BINLOG '
fAS3SBMBAAAALAAAAJABAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ=
fAS3SBkBAAAAKgAAALoBAAAQABEAAAAAAAEAA//4AQAAAARwZWFyIbIP
'/*!*/;
### DELETE FROM test.t
### WHERE
### @1=1 /* INT meta=0 nullable=0 is_null=0 */
### @2='pear' /* VARSTRING(20) meta=20 nullable=0 is_null=0 */
### @3='2009:01:01' /* DATE meta=0 nullable=1 is_null=0 */
BINLOG--base64-output=DECODE-ROWS--base64-output=NEVER--base64-output=DECODE-ROWS--verbose
内核> mysqlbinlog -v --base64-output=DECODE-ROWS...# at 218#080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_F### INSERT INTO test.t### SET### @1=1### @2='apple'### @3=NULL...# at 302#080828 15:03:08 server id 1 end_log_pos 356 Update_rows: table id 17 flags: STMT_END_F### UPDATE test.t### WHERE### @1=1### @2='apple'### @3=NULL### SET### @1=1### @2='pear'### @3='2009:01:01'...# at 400#080828 15:03:08 server id 1 end_log_pos 442 Delete_rows: table id 17 flags: STMT_END_F### DELETE FROM test.t### WHERE### @1=1### @2='pear'### @3='2009:01:01'log_file
BINLOG
--verboseBINLOG
@NN
BINLOG
BINLOG--base64-output=NEVER
--read-from-remote-server--result-file=file_name
--read-from-remote-server
--raw
--read-from-remote-server--host--user--password
--raw
--stop-never
--connection-server-id=id--stop-never--connection-server-id
--result-file
SHOW
BINARY LOGS
MySQL的> SHOW BINARY LOGS;--------------- ----------- | log_name | file_size | --------------- ----------- | binlog.000130 | 27459 | | binlog.000131 | 13719 | | binlog.000132 | 43268 | --------------- -----------
binlog.000130
mysqlbinlog --read-from-remote-server --host=host_name--raw binlog.000130 binlog.000131 binlog.000132 mysqlbinlog --read-from-remote-server --host=host_name--raw --to-last-log binlog.000130
--to-last-logbinlog.000132
binlog.000130
mysqlbinlog --read-from-remote-server --host=host_name--原料--永不停止binlog.000130
--stop-never--to-last-log
--raw--result-file--raw--result-file--raw--result-file
binlog.000999--result-file--result-file--result-file
--result-file | |
|---|---|
--result-file=x | xbinlog.000999 |
--result-file=/tmp/ | /tmp/binlog.000999 |
--result-file=/tmp/x | /tmp/xbinlog.000999 |
host_name
mysqlbinlog --read-from-remote-server --host=host_name --raw
--stop-never binlog.000999
--all-databases--events--routines--master-data=2
mysqldump --host=host_name--all-databases --events --routines --master-data=2>dump_file
mysql --host=host_name-u root -p <dump_file
-- CHANGE MASTER TO MASTER_LOG_FILE='binlog.001002', MASTER_LOG_POS=27284;
binlog.001004
mysqlbinlog --start-position=27284 binlog.001002 binlog.001003 binlog.001004 | mysql --host=host_nameU P根
root
--read-from-remote-server
Binlog dump
--to-last-logBinlog dump
--stop-never--to-last-logBinlog dump
--read-from-remote-server
--read-from-remote-server--stop-never--connection-server-id
--stop-never
N-a
shell> mysqldumpslow [options] [log_file ...]
N
--debug
*-slow.log
N
sort_type
t
l
r
c
-s at
N
shell> mysqldumpslow
Reading mysql slow query log from /usr/local/mysql/data/mysqld51-apple-slow.log
Count: 1 Time=4.32s (4s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost
insert into t2 select * from t1
Count: 3 Time=2.53s (7s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost
insert into t2 select * from t1 limit N
Count: 3 Time=2.13s (6s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost
insert into t1 select * from t1
[client]
shell> my_print_defaults client mysql
--port=3306
--socket=/tmp/mysql.sock
--no-auto-rehash
libmysqlclient--include
--cflags
--libs
var_namepkglibdir
shell> mysql_config
Usage: /usr/local/mysql/bin/mysql_config [options]
Options:
--cflags [-I/usr/local/mysql/include/mysql -mcpu=pentiumpro]
--cxxflags [-I/usr/local/mysql/include/mysql -mcpu=pentiumpro]
--include [-I/usr/local/mysql/include/mysql]
--libs [-L/usr/local/mysql/lib/mysql -lmysqlclient
-lpthread -lm -lrt -lssl -lcrypto -ldl]
--libs_r [-L/usr/local/mysql/lib/mysql -lmysqlclient_r
-lpthread -lm -lrt -lssl -lcrypto -ldl]
--plugindir [/usr/local/mysql/lib/plugin]
--socket [/tmp/mysql.sock]
--port [3306]
--version [5.8.0-m17]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/mysql/include]
pkglibdir [/usr/local/mysql/lib]
plugindir [/usr/local/mysql/lib/plugin]
gcc -c `mysql_config --cflags` progname.c gcc -o progname progname.o `mysql_config --libs`
[mysqlcheck]
shell>my_print_defaults mysqlcheck client--user=myusername --password=password--host=localhost
--help
--config-file=file_name--defaults-file=file_namefile_name
--debug=debug_optionsdebug_options
debug_optionsfile_name
--defaults-extra-file=file_name--extra-file=file_namefile_name
--defaults-group-suffix=suffixsuffix
--login-path=namename
.mylogin.cnf
--show
shell> resolve_stack_dump [options] symbols_file [numeric_dump_file]
--help
--numeric-dump-file=file_namefile_name
--symbols-file=file_namefile_name
-DWITH_LZ4=system
shell> lz4_decompress input_file output_file
shell>mysqlpump --compress-output=LZ4 > dump.lz4shell>lz4_decompress dump.lz4 dump.txt
shell> perror [options] errorcode ...
ER_WRONG_VALUE_FOR_VAR1231MY-1231ER_WRONG_VALUE_FOR_VAR
内核> perror 1231MySQL错误代码my-001231(er_wrong_value_for_var):变量''%1 - .64s不能设置为“%的价值.200s”
shell> perror 1 13
OS error code 1: Operation not permitted
MySQL error code MY-000001: Can't create/write to file '%s' (OS errno %d - %s)
OS error code 13: Permission denied
MySQL error code MY-000013: Can't get stat of '%s' (OS errno %d - %s)
--ndb
内核> perror --ndberrorcode
shell> resolveip [options] {host_name|ip-addr} ...
-DWITH_ZLIB=system
shell> zlib_decompress input_file output_file
shell>mysqlpump --compress-output=ZLIB > dump.zlibshell>zlib_decompress dump.zlib dump.txt
AUTHENTICATION_PAM_LOG | |
CC | |
CXX | |
CC | |
DBI_USER | |
DBI_TRACE | |
HOME | $HOME/.mysql_history |
LD_RUN_PATH | libmysqlclient.so |
LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN | mysql_clear_password |
LIBMYSQL_PLUGIN_DIR | |
LIBMYSQL_PLUGINS | |
MYSQL_DEBUG | |
MYSQL_GROUP_SUFFIX | --defaults-group-suffix |
MYSQL_HISTFILE | $HOME/.mysql_history |
MYSQL_HISTIGNORE | $HOME/.mysql_history--syslog |
MYSQL_HOME | my.cnf |
MYSQL_HOST | |
MYSQL_OPENSSL_UDF_DH_BITS_THRESHOLD | CREATE_DH_PARAMETERS() |
MYSQL_OPENSSL_UDF_DSA_BITS_THRESHOLD | CREATE_ASYMMETRIC_PRIV_KEY() |
MYSQL_OPENSSL_UDF_RSA_BITS_THRESHOLD | CREATE_ASYMMETRIC_PRIV_KEY() |
MYSQL_PS1 | |
MYSQL_PWD | |
MYSQL_TCP_PORT | |
MYSQL_TEST_LOGIN_FILE | .mylogin.cnf |
MYSQL_TEST_TRACE_CRASH | |
MYSQL_TEST_TRACE_DEBUG | |
MYSQL_UNIX_PORT | localhost |
MYSQLX_TCP_PORT | |
MYSQLX_UNIX_PORT | localhost |
NOTIFY_SOCKET | |
PATH | |
PKG_CONFIG_PATH | mysqlclient.pc |
TMPDIR | |
TZ | |
UMASK | |
UMASK_DIR | |
USER |
MYSQL_TEST_LOGIN_FILE%APPDATA%\MySQL\.mylogin.cnf
MYSQL_TEST_TRACE_DEBUG
UMASK0640UMASKUMASK=0600UMASK=384
UMASK
PKG_CONFIG_PATH