Replication between MySQL tables, with databases and different databases

Source: Internet
Author: User

MySQL's statement

We can first export the structure of the T1 table under test and create a new test1.t1 table.

Execute the following statement

INSERT INTO TEST1.T1 select * from Test.t1 limit 2 (limit bar number)


If you are in a database that is



INSERT INTO T1 SELECT * from T2 limit 2


If the table structure is not the same two tables, you can consider, and refer to the following statement

INSERT into Db_ds_edu.t_exam_student (stu_id,stu_number,stu_name,school_id,campus_id,grade_id,class_id,xuebu_id)   SELECT stu.id,      stu.student_num     , Person.name      , stu.school_id      , stu.campus_id      , Stu.grade_ ID      , stu.clas_id      , stu.xuebu_id from   Db_ds.t_stu_info as Stu     , db_ds.t_p_person_info as Person     

What, da?



INSERT INTO TEST1.T1 select * from TEST.T1 limit 2

Replication between MySQL tables, with databases and different databases

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.