MySQL的安装程序中有很多不同的程序。本节提供了一个它们的简短的概述。下一节提供了对每个程序详细的描述。每个程序的描述提供了它们的调用语法和它们支持的选项。 Section 18.4, “MySQL Cluster Programs”针对MySQL集群进行了描述。
大部分MySQL版本包括所有的这些程序,除了那些指定平台格式的程序。(例如,服务器启动脚本不用于Windows上)这个例外是由于 RPM分配非常专业。一个RPM服务这个服务器,另一个服务客户端程序等等。如果你好像遗漏了一个或多个程序,请查看
Chapter 2, Installing and Upgrading
MySQL。这一章提供了更多分配类型相关的信息。前提是你未安装所有程序,并且你需要安装额外的包。
每一个MySQL程序有很多不同的选项。大多数程序提供–help选项帮助你得到这个程序不同选项的描述。例如,尝试输入 mysql –help。
你可以通过在命令行或选项文件中指定选项来重写默认选项值。请查看 Section 4.2, “Using MySQL Programs”。本节提供了调用函数和指定程序选项的信息。
MySQL 服务 mysqld是一个主要的程序,它承担MySQL安装过程中的大部分工作。这个服务连同几个相关脚本来协助你开启和关闭服务。
• mysqld
The SQL daemon (that is, the MySQL server). To use client programs, mysqldmust be running,
because clients gain access to databases by connecting to the server. See Section 4.3.1, “mysqld
— The MySQL Server”.
• mysqld_safe
A server startup script. mysqld_safeattempts to start mysqld. See Section 4.3.2, “mysqld_safe
— MySQL Server Startup Script”.
• mysql.server
A server startup script. This script is used on systems that use System V-style run directories
containing scripts that start system services for particular run levels. It invokes mysqld_safeto start
the MySQL server. See Section 4.3.3, “mysql.server— MySQL Server Startup Script”.
• mysqld_multi
A server startup script that can start or stop multiple servers installed on the system. See
Section 4.3.4, “mysqld_multi— Manage Multiple MySQL Servers”.
Overview of MySQL Programs
247
Several programs perform setup operations during MySQL installation or upgrading:
• comp_err
This program is used during the MySQL build/installation process. It compiles error message files
from the error source files. See Section 4.4.1, “comp_err— Compile MySQL Error Message File”.
• mysql_install_db
This program initializes the MySQL data directory, creates the mysqldatabase and initializes
its grant tables with default privileges, and sets up the InnoDB system tablespace. It is
usually executed only once, when first installing MySQL on a system. See Section 4.4.3,
“mysql_install_db— Initialize MySQL Data Directory”, and Section 2.10, “Postinstallation Setup
and Testing”.
• mysql_plugin
This program configures MySQL server plugins. See Section 4.4.4, “mysql_plugin— Configure
MySQL Server Plugins”.
• mysql_secure_installation
This program enables you to improve the security of your MySQL installation. See Section 4.4.5,
“mysql_secure_installation— Improve MySQL Installation Security”.
• mysql_tzinfo_to_sql
This program loads the time zone tables in the mysqldatabase using the contents of the
host system zoneinfodatabase (the set of files describing time zones). See Section 4.4.6,
“mysql_tzinfo_to_sql— Load the Time Zone Tables”.
• mysql_upgrade
This program is used after a MySQL upgrade operation. It checks tables for incompatibilities and
repairs them if necessary, and updates the grant tables with any changes that have been made in
newer versions of MySQL. See Section 4.4.7, “mysql_upgrade— Check and Upgrade MySQL
Tables”.
MySQL client programs that connect to the MySQL server:
• mysql
The command-line tool for interactively entering SQL statements or executing them from a file in
batch mode. See Section 4.5.1, “mysql— The MySQL Command-Line Tool”.
• mysqladmin
A client that performs administrative operations, such as creating or dropping databases, reloading
the grant tables, flushing tables to disk, and reopening log files. mysqladmincan also be used to
retrieve version, process, and status information from the server. See Section 4.5.2, “mysqladmin
— Client for Administering a MySQL Server”.
• mysqlcheck
A table-maintenance client that checks, repairs, analyzes, and optimizes tables. See Section 4.5.3,
“mysqlcheck— A Table Maintenance Program”.
• mysqldump
A client that dumps a MySQL database into a file as SQL, text, or XML. See Section 4.5.4,
“mysqldump— A Database Backup Program”.
• mysqlimport
Overview of MySQL Programs
248
A client that imports text files into their respective tables using LOAD DATA INFILE. See
Section 4.5.5, “mysqlimport— A Data Import Program”.
• mysqlshow
A client that displays information about databases, tables, columns, and indexes. See Section 4.5.6,
“mysqlshow— Display Database, Table, and Column Information”.
• mysqlslap
A client that is designed to emulate client load for a MySQL server and report the timing of each
stage. It works as if multiple clients are accessing the server. See Section 4.5.7, “mysqlslap—
Load Emulation Client”.
MySQL administrative and utility programs:
• innochecksum
An offline InnoDBoffline file checksum utility. See Section 4.6.1, “innochecksum— Offline InnoDB
File Checksum Utility”.
• myisam_ftdump
A utility that displays information about full-text indexes in MyISAMtables. See Section 4.6.2,
“myisam_ftdump— Display Full-Text Index information”.
• myisamchk
A utility to describe, check, optimize, and repair MyISAMtables. See Section 4.6.3, “myisamchk—
MyISAM Table-Maintenance Utility”.
• myisamlog
A utility that processes the contents of a MyISAMlog file. See Section 4.6.4, “myisamlog— Display
MyISAM Log File Contents”.
• myisampack
A utility that compresses MyISAMtables to produce smaller read-only tables. See Section 4.6.5,
“myisampack— Generate Compressed, Read-Only MyISAM Tables”.
• mysql_config_editor
A utility that enables you to store authentication credentials in a secure, encrypted login path file
named .mylogin.cnf. See Section 4.6.6, “mysql_config_editor— MySQL Configuration
Utility”.
• mysqlaccess
A script that checks the access privileges for a host name, user name, and database combination.
See Section 4.6.7, “mysqlaccess— Client for Checking Access Privileges”.
• mysqlbinlog
A utility for reading statements from a binary log. The log of executed statements contained in the
binary log files can be used to help recover from a crash. See Section 4.6.8, “mysqlbinlog—
Utility for Processing Binary Log Files”.
• mysqldumpslow
A utility to read and summarize the contents of a slow query log. See Section 4.6.9,
“mysqldumpslow— Summarize Slow Query Log Files”.
Overview of MySQL Programs
249
• mysqlhotcopy
A utility that quickly makes backups of MyISAMtables while the server is running. See
Section 4.6.10, “mysqlhotcopy— A Database Backup Program”.
• mysql_convert_table_format
A utility that converts tables in a database to use a given storage engine. See Section 4.6.11,
“mysql_convert_table_format— Convert Tables to Use a Given Storage Engine”.
• mysql_find_rows
A utility that reads files containing SQL statements (such as update logs) and extracts statements
that match a given regular expression. See Section 4.6.12, “mysql_find_rows— Extract SQL
Statements from Files”.
• mysql_fix_extensions
A utility that converts the extensions for MyISAMtable files to lowercase. This can be useful
after transferring the files from a system with case-insensitive file names to a system with casesensitive file names. See Section 4.6.13, “mysql_fix_extensions— Normalize Table File Name
Extensions”.
• mysql_setpermission
A utility for interactively setting permissions in the MySQL grant tables. See Section 4.6.14,
“mysql_setpermission— Interactively Set Permissions in Grant Tables”.
• mysql_waitpid
A utility that kills the process with a given process ID. See Section 4.6.15, “mysql_waitpid— Kill
Process and Wait for Its Termination”.
• mysql_zap
A utility that kills processes that match a pattern. See Section 4.6.16, “mysql_zap— Kill Processes
That Match a Pattern”.
MySQL program-development utilities:
• msql2mysql
A shell script that converts mSQLprograms to MySQL. It doesn’t handle every case, but it gives a
good start when converting. See Section 4.7.1, “msql2mysql— Convert mSQL Programs for Use
with MySQL”.
• mysql_config
A shell script that produces the option values needed when compiling MySQL programs. See
Section 4.7.2, “mysql_config— Display Options for Compiling Clients”.
• my_print_defaults
A utility that shows which options are present in option groups of option files. See Section 4.7.3,
“my_print_defaults— Display Options from Option Files”.
• resolve_stack_dump
A utility program that resolves a numeric stack trace dump to symbols. See Section 4.7.4,
“resolve_stack_dump— Resolve Numeric Stack Trace Dump to Symbols”.
Miscellaneous utilities:
Using MySQL Programs
250
• perror
A utility that displays the meaning of system or MySQL error codes. See Section 4.8.1, “perror—
Explain Error Codes”.
• replace
A utility program that performs string replacement in the input text. See Section 4.8.2, “replace— A
String-Replacement Utility”.
• resolveip
A utility program that resolves a host name to an IP address or vice versa. See Section 4.8.3,
“resolveip— Resolve Host name to IP Address or Vice Versa”.