Back up data from host A to host B
Mysqldump-uroot-p vw> vw. SQL
Back up the database file and restore it to the target machine B. The database version of B is 5.5.23, And the mysql version of machine A is 5.0.22.
- Mysql> source/root/vw. SQL;
- ............................................................
- Query OK, 6748 rows affected (0.13 sec)
- Records: 6748 Duplicates: 0 Warnings: 0
- Query OK, 6807 rows affected (0.12 sec)
- Records: 6807 Duplicates: 0 Warnings: 0
- Query OK, 6752 rows affected (0.13 sec)
- Records: 6752 Duplicates: 0 Warnings: 0
- Query OK, 6659 rows affected (0.13 sec)
- Records: 6659 Duplicates: 0 Warnings: 0
- Query OK, 6676 rows affected (0.13 sec)
- Records: 6676 Duplicates: 0 Warnings: 0
- Query OK, 6583 rows affected (0.12 sec)
- Records: 6583 Duplicates: 0 Warnings: 0
- Query OK, 6598 rows affected (0.13 sec)
- Records: 6598 Duplicates: 0 Warnings: 0
- ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''at line 1
- Mysql>
The above error occurs when you import data on machine B to exclude the database itself. Later, you used the navicat tool to back up data of machine A and then imported the data to machine B again.
It was found that it was caused by character set problems. The solution is as follows:
Back up the data on machine A and run the following command to restore the data to machine B and test OK.
- mysqldump -uroot --default-character-set=utf8 -p vw>vw.sql