1. Connect MySQL
Format: mysql-h host address-u user name-P user Password
1.1. Connect to MySQL on this machine.
First open the DOS window, then enter the directory Mysql/bin, and then type the command mysql-u root-p, enter the password prompt. The prompt for MySQL is: mysql>
1.2. Connect to MySQL on the remote host. Assume that the remote host IP is: 10.10.10.10, the user name is root, the password is 123. Type the following command:
Mysql-h10.10.10.10-u Root-p 123; (Note: You can not add a space between the root and the other)
1.3. Exit MySQL command: Exit (enter)
2, about the database command
2.1, create the database (SQL statement must have;)
Mysql>create database databasename;
2.2. Connect to the database:
Mysql>use DatabaseName;
2.3. Display database:
Mysql>show databases;
2.4. Delete the database:
Mysql>drop database databasename;
3. Commands for data tables
3.1. View the tables in the database:
Mysql>show tables;
3.2. Description Table structure:
Mysql>describe TableName;
3.3. Modify the type of Table property:
Mysql>alter Table tablename Modify field property to be modified to the type;
3.4. Renaming indicates:
Mysql>rename table Old_tablename to New_tablename,
4, about the list of data table partition
4.1, first need to see whether the current database supports partitioning
Mysql>show variables like '%partition% ';
4.2. Add Table partition:
Example:
ALTER TABLE wc_day66
Partitionby list [columns] (region)
(
Partition P1 values in (0),
Partition P2 values in (1),
Partition P3 values in (2),
Partition P4 values in (3)
);
4.3. Delete the partition:
Example:
ALTER TABLE wc_day66 drop partition p1;
This article is from the "Fire Blue" blog, be sure to keep this source http://fireblue.blog.51cto.com/9934670/1693661
MySQL Common commands summary (1)