I. Introduction of IDE Tools
Master: # 1. Test + link Database #2. New library #3. New table, new field + type + constraint #4. Design table: Foreign key # 5. New Query #6. Backup Library/Table # Note: Batch add Comment: Ctrl +? Key batch to comment: Ctrl+shift+? Key
Second, MySQL data backup
# 1. Physical backup: Direct copy of database files for large database environments. But cannot be restored to heterogeneous systems such as Windows (requires platform consistency). #2. Logical Backup: Backup is the SQL statement executed by the operation of the table, build, insert, etc., for small and medium sized databases, the efficiency is relatively low. #3. Export table: Import the table into a text file.
1. Using Mysqldump for logical backups
# Syntax: # mysqldump-h Server-u user name-p password database name > backup file. sql ## Single Library backup mysqldump-uroot-p123 db1 >-uroot-p123 db1 table1 table2 > d:\\db1-table1-table2.sql< c8/> #备份表 # multi-Library backup mysqldump-uroot-p123--databases db1 db2 mysql db3 >d:\\ db1_db2_mysql_ Db3.sql# back up all libraries mysqldump-uroot-p123--all-databases > D:\\all.sql
2. Restoring a logical backup
# method One:mysql-uroot-p123 day47< d:\\day47.sql (to have day47 Library in advance)# method Two:create Database Day47;use Day47;source d:\\day47
3. View data in a database without entering the database
4. Database migration (Extended understanding)
be sure to migrate between the same versions # mysqldump-h source ip-uroot-p123--databases db1 | mysql-h target ip-uroot-p456
5. Export and import of tables
SELECT ... into OUTFILE export text file example: MySQL> SELECT *From School.student1into OUTFILE'Student1.txt'Fields TERMINATED by','//defining field separators optionally enclosed by'"'//defines what symbols to use in a string lines TERMINATED by'\ n'; //example of defining a line break MySQL command to export a text file:#mysql-u root-p123-e ' select * from Student1.school ' >/tmp/student1.txt#mysql-u root-p123--xml-e ' select * from Student1.school ' >/tmp/student1.xml#mysql-u root-p123--html-e ' select * from Student1.school ' >/tmp/student1.htmlLOAD DATA INFILE importing text files MySQL>DELETE from Student1;mysql> LOAD DATA INFILE'/tmp/student1.txt'Into TABLE school.student1fields TERMINATED by','optionally enclosed by'"'LINES TERMINATED by'\ n';
Python-day47--mysql Data Backup and recovery