Home >> FAQs/Tutorials >> MySQL Tutorials

MySQL FAQs - Command-Line End User Interface mysql

By: FYIcenter.com

Part:   1  2  3   4 

(Continued from previous part...)

What Are the Non-Standard SQL Commands Supported by "mysql"?

There are many non-standard SQL commands that are supported by "mysql". Here is short list of some commonly used commands:

  • "SHOW infoName" - Shows basic information of based on the specified information name.
  • "SHOW infoName" - Shows basic information of based on the specified information name.
  • "SET ..." - Sets new values to server or connection session variables.
  • "GRANT ..." - Grants access privileges to users.
  • "REVOKE ..." - Revokes access privileges from users.
  • "CHECK TABLE tableName" - Checks the specified table for errors.
  • "ANALYZE TABLE tableName" - Analyzes the specified table.
  • "REPAIR TABLE tableName" - Repairs the specified table.
  • "BACKUP TABLE tableName" - Backs up the specified table.
  • "RESTORE TABLE tableName" - Restores the specified table.
  • "USE databaseName" - Uses the specified database as the current database.
  • "HELP topicName" - Returns help information on the specified topic.

Here is a tutorial exercise of how to use SHOW, USE and ANALYZE commands in "mysql":

>cd \mysql\bin
>mysql -u root

mysql> USE test;
Database changed

mysql> SHOW TABLES;
+----------------+
| Tables_in_test |
+----------------+
| articles       |
| links          |
+----------------+
2 rows in set (0.00 sec)

mysql> ANALYZE TABLE links;
+----------+-------+--------+---------------------------+
|Table     |Op     |Msg_type|Msg_text                   |
+----------+-------+--------+---------------------------+
|test.links|analyze|status  |Table is already up to date|
+----------+-------+--------+---------------------------+
1 row in set (0.14 sec)

How To Get Help Information from the Server?

While you are at the "mysql>" prompt, you can get help information from the server by using the "HELP" command. The tutorial exercise below shows sevearal examples:

>cd \mysql\bin
>mysql -u root

mysql> HELP;
...
List of all MySQL commands:
Note that all text commands must be end with ';'
?         (\?) Synonym for `help'.
clear     (\c) Clear command.
connect   (\r) Reconnect to the server. 
...

mysql> HELP SHOW;
Name: 'SHOW'
Description:
SHOW has many forms that provide information about 
databases, tables, columns, or status information about 
the server. This section describes those following:

SHOW CREATE DATABASE db_name
SHOW CREATE FUNCTION funcname
SHOW CREATE PROCEDURE procname
SHOW CREATE TABLE tbl_name
SHOW DATABASES [LIKE 'pattern']
SHOW ENGINE engine_name {LOGS | STATUS }
...

mysql> HELP CREATE TABLE;
Name: 'CREATE TABLE'
Description:
Syntax:
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
    (create_definition,...)
    [table_option ...]
...

(Continued on next part...)

Part:   1  2  3   4 

MySQL Tutorials:

More...


Other Tutorials/FAQs:

More...


Related Resources:

More...


Selected Jobs:

More...