Logical Backup MysqldumpThe Mysqldump Backup tool was originally written by Igor Romanenko and is typically used to complete a backup of the dump database and porting between different databases, such as upgrading from a low-version MySQL database
MySQL management data can certainly be very convenient to export data, but when the amount of data is very large, phpmyadmin is likely to occur execution timeout, in fact, it is easy to use SELECT INTO OutFile solution!
SELECT ... The main function
Select ... into outfile ' path ' backupThis is a very fast recovery, much faster than insert insertion, and unlike backup-rich mysqldump, he can only back up data in a table, and cannot contain the structure of a table. If the table is drop after
SELECT into ... The OUTFILE statement exports the table data to a text file and uses the load data ... The infile statement restores the data. However, this method can only export or import the contents of the data, not including the structure of
in the sample CSV exampleSelect ... into outfile ... is not with the field name, only export data, so you need to think of another way to implement, here is a stupid trick, you construct a field column, the example is as follows:1. Create Test table
1.SELECT ... into outfile reads a text file that is stored in a data row from a table.The 2.LOAD DATA infile statement is used to read rows from a text file at high speed and to mount a table.3. Grammar rulesA) SELECT * into outfile '/root/outfile11.
Set character_set_client= ' GBK ';Set character_set_connection= ' GBK ';Set character_set_database= ' GBK ';Set character_set_results= ' GBK ';Set character_set_server= ' GBK ';Select ' 2 ' into outfile ' c:\\ is \\22b.txt ';It should be a lot of
encountered a large number of import and export data is really troublesome, moving a few g of data, the operation is relatively slow, and if a little careless, but also to rewrite the process, the simplest method is also the least efficient way is
Backup syntax:SELECT * FROM table name where condition into outfile '/tmp/table name. txt ';#注意保存位置 the permissions of/tmp;#注意备份文件的格式;Recovery syntax:Load Data infile ' table name '. ' Into table name;#注意恢复时备份文件的位置要存放在mysql the database data library
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.