MySQL 面试题与答案
问题 46. How To Analyze Tables with "mysqlcheck"?
If you want analyze tables with "mysqlcheck", you need to use the "--analyze" option. The following tutorial exercise shows you how to analyze all tables in "mysql" database:
>cd mysqlbin
>mysqlcheck -u root --analyze mysql
mysql.columns_priv Table is already up to date
mysql.db Table is already up to date
mysql.func Table is already up to date
mysql.help_category Table is already up to date
mysql.help_keyword Table is already up to date
mysql.help_relation Table is already up to date
mysql.help_topic Table is already up to date
mysql.host Table is already up to date
mysql.proc Table is already up to date
mysql.tables_priv Table is already up to date
mysql.time_zone Table is already up to date
mysql.time_zone_leap_second Table is already up to date
mysql.time_zone_name Table is already up to date
mysql.time_zone_transition Table is already up to date
mysql.time_zone_transition_type Table is already up to date
mysql.user Table is already up to date
问题 47. What Is "mysqlshow"?
"mysqlshow" is a command-line interface for end users to see information on tables and columns. Here are some sample commands supported by "mysqlshow":
► "mysqlshow" - Shows all the databases.
► "mysqlshow databaseName" - Shows all the tables in the specified database.
► "mysqlshow databaseName tableName" - Shows all the columns in the specified table.
► "mysqlshow --verbose" - Shows all the databases with extra information.
► "mysqlshow --verbose my%" - Shows all the databases who's names match the pattern "my%" with extra information.
► "mysqlshow --verbose mysql time%" - Shows all the tables who's names match the pattern "time%" in "mysql" database with extra information.
问题 48. What Is "mysqldump"?
"mysqldump" - A command-line interface for administrators or end users to export data from the server to files. Here are some sample commands supported by "mysqldump":
► "mysqldump databaseName tableName" - Dumps the specified table in the specified database.
► "mysqldump databaseName" - Dumps all the tables in the specified database.
问题 49. How To Dump a Table to a File with "mysqldump"?
If you want to dump all rows in a table from the server to a file, you can use "mysqldump" with the "-f fileName" option as show in the following tutorial exercise:
>cd mysqlbin
>mysqldump -u root -r templinks.txt test links
>type templinks.txt
>type templinks.txt | more
-- MySQL dump 10.10
--
-- Host: localhost Database: test
-- ------------------------------------------------------
-- Server version 5.0.24-community
...
The dump file contains SQL statements that you can use to restore the table and its data content.
问题 50. What Is "mysqlimport"?
"mysqlimport" - A command-line interface for administrators or end users to load data files into tables program tool to load data into tables. Here is a sample commands supported by "mysqlimport":
► "mysqlimport databaseName fileName" - Imports the data from the specified file to the specified database. The data will be loaded into the table who's name matches the specified file name.
用户评价最有帮助的内容: