MySQL Table Backup

Source: Internet
Author: User

    • There is no pre-built table, direct backup, but MySQL does not support select into to back up the table, but you can use the following table statement to back up:

CREATE TABLE User_backup (SELECT * from user), select * from User_backup;
[Sql]create Table User_backup (SELECT * from user); Affected Rows:22time:0.129s[sql]select * from User_backup; Affected rows:0time:0.001s
    • Pre-existing tables, copy data from the table in the data source to insert into the target table

mysql> INSERT INTO User_temp (SELECT * from user); Query OK, Rows affectedrecords:22 duplicates:0 warnings:0mysql> select * from User_temp;
    • Clears table data, preserves table structure

mysql> truncate TABLE user_temp; Query OK, 0 rows affectedmysql> select * from User_temp; Empty Set
    • In addition, SQL Server supports select INTO, but does not support the SELECT INTO

Use Hunlian;select * to Member_backup in Hunlian-test.mdb from Hunlian.dbo.member;
[Sql]use hunlianaffected Rows:0time:0.007s[sql]select * into Member_backup in Hunlian-test.mdb from hunlian.dbo.member[ ERR] 42000-There is a syntax error near the [SQL Server] keyword ' in '. Affected rows:0
Use hunlian;/* because the two tables contain the same ID field, the direct select * from conflict */select Member.name,member.mail,userinfo.city,userinfo.birthday into Member_backup from Memberinner join userinfo on member.id = Userinfo.id;select * from Member_backup;select * from member I Nner Join userinfo on member.id = userinfo.id;


MySQL Table Backup

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.