Replication of MySQL tables and replication of data

Source: Internet
Author: User

Replication of tables

  Full replication: CREATE TABLE New_service select * from service;

Partial copy: Create TABLE User (host char, user char (+)) Select Host,user from mysql.user where restriction condition;

or create table t3 (x char, y char) select name as x, user as y from TableName;

       P.S. If CREATE table t3 (x char, y char) select name, user from TableName;

———— establishes name,user two columns after x, y two empty columns

To copy only the table header:

CREATE TABLE User (host char), user char (+)) Select Host,user from Mysql.user where arbitrary false condition

P.s. This method does not copy key

CREATE table new_user like user; This method key also replicates

Replication of records

INSERT INTO TableName (col1,col2,col3. COLN)

Select (Col1,col2,col3...coln) from tablename2 where condition;

Replication of MySQL tables and replication of data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.