In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following mainly brings you several main methods of Mysql replication table structure and table data. I hope these contents can bring you practical use. This is also the main purpose of this article that I edit Mysql replication table structure and table data. All right, don't talk too much nonsense, let's just read the following.
1. Copy the table structure and data to the new table
CREATE TABLE new table SELECT * FROM old table
This method will copy everything in oldtable, and of course we can use
Delete from newtable
To delete.
However, one of the worst aspects of this approach is that the new table does not have the primary key, Extra (auto_increment) and other properties of the old table. You need to add it yourself with the alter command, and it's easy to get it wrong.
2. Only copy the table structure to the new table
CREATE TABLE new table SELECT * FROM old table WHERE 1 # 2
Or CREATE TABLE new table LIKE old table
3. Copy the data from the old table to the new table (assuming the structure of the two tables is the same)
INSERT INTO new table SELECT * FROM old table
4. Copy the data from the old table to the new table (assuming that the structure of the two tables is different)
INSERT INTO new table (field 1, field 2.) SELECT field 1, field 2. FROM old watch
5. You can copy the structure of Table 1 to Table 2
SELECT * INTO Table 2 FROM Table 1 WHERE 1
6. You can copy all the contents of Table 1 to Table 2.
SELECT * INTO Table 2 FROM Table 1
7. Show create table old table
This lists the creation commands for the old table. We just need to copy the command and change the name of table to create an identical table.
8 、 mysqldump
Use mysqldump to dump the table, rename it and import it back, or run it directly on the command line
For the above about the Mysql replication table structure, table data of the main methods, we do not find it very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.