First, export:
Syntax: mysqldump --default-Character-the SET = GB2312 - U user name - the p-code database name --add-drop-the Table -d > export file name . SQL
note:
The password can be omitted. If omitted, the program will prompt for a password;
-d export table structure only, no table data;
--add-drop-table --add-drop-table to add a drop table before each create statement;
--default-character-set = gb2312 derived database specified character set encoding
mysqldump command path is based on your MySQL installation path decisions, but generally you can use this command in any path;
eg.
# /usr/local/mysql/bin/mysqldump -uroot -p abc > abc.sql
You will be prompted to enter the password and press the Enter key, enter it.
Second, import:
method one,
Syntax: MySQL --default-Character-the SET = GB2312 - U user name - the p-code database name < export file name . SQL
note:
The password can be omitted. If omitted, the program will prompt for a password;
--default-character-set = gb2312 derived database specified character set encoding
eg.
# mysql -uroot -p123456 < abc.sql
Method Two,
Use the source command to import. We need to use the source command to log in to mysql and create an empty database:
MySQL > Create Database ABC ; # create a database MySQL > use ABC ; database created using # MySQL > SET names UTF8 ; # set the encoding MySQL > Source / Home / ABC / ABC . SQL # import the backup database
Note sql file path to your backup.