Home  >  Article  >  Database  >  How to use MySQL database commands to create and view partitions

How to use MySQL database commands to create and view partitions

黄舟
黄舟Original
2017-08-07 14:54:533181browse

MySQL partitioning is to decompose the database table into multiple parts according to certain rules to facilitate management. Each partition is an independent object and can be processed by itself or as part of the original table. Let's use several MySQL commands to view table partitions and create table partitions. The operations are as follows:

How to use MySQL database commands to create and view partitions

1. The first step is to check whether the current MySQL database supports partitioning. You can Use the following command

show variables like '%partition%';

as shown below:

How to use MySQL database commands to create and view partitions

2. The second step is to determine whether the current database version has a partition installed. Plug-in, use the following command

show plugins;

as shown below:

How to use MySQL database commands to create and view partitions

3. The third step is to create the database table and create the table Partition, use the command, and the error is reported, as shown below:

How to use MySQL database commands to create and view partitions


##4. The fourth step is to modify the primary key setting of the created database table, remove it, and run the command again, as shown in the following figure:

How to use MySQL database commands to create and view partitions


5. Step 5. Check whether a table is a partitioned table , you can use the following command

show table status;

as shown below:

How to use MySQL database commands to create and view partitions

6. The sixth step is to view a specific database For the partitioning of a table, you can use the following command, as shown in the figure below:

How to use MySQL database commands to create and view partitions


##Note

Note how to use commands to create table partitions

Note how to use commands to view partitions

The above is the detailed content of How to use MySQL database commands to create and view partitions. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn