A simple MySQL Database Import backup,
Task objective: to import content from the current database (MySQL5.5, windows) to the test database (MySQL5.1, linux)
1. Because I am not familiar with MySQL, I first considered the solution to be handled using a ready-made database management tool. I failed to use both Navicat Premium and SQLyog. The data is exported successfully each time, but errors are always interrupted during import.
2. roughly estimate the cause of failure:
(1) version issues, but have been ruled out.
(2) content, because the project table does not contain simple text data, which contains a large amount of binary data, views, functions, and trigger data to be exported.
(3) garbled characters left by history. This project was changed from an old project extension. Some table structures are garbled during replication, causing an error during import.
3. The tool is not easy to use, so MySQL command is used for processing.
Export:
Mysqldump.exe-uroot-proot -- default-character-set = utf8 -- opt -- extended-insert = false -- triggers-R -- hex-blob-x house> \ x
Import
Mysql> source/x
4. the table and data are normal during import. However, the log_bin_trust_function_creators error is returned when the custom function is imported. Solution:
Set global log_bin_trust_function_creators = 1;
However, this method becomes invalid after restart. The permanent solution is to directly modify my. ini
Add log_bin_trust_function_creators = 1 to [mysqld ].
5. The import is successful and the task is completed.
Because I have never performed any operations on the test server before, I found that two MySQL services are installed in the server. I am not using the mysql command to log on directly, so I need to find the MySQL. sock address of mysql first.
Ps aux | grep mysqld
First look at the process and find the address -- socket =/tmp/mysql. sock
Mysql-uroot-p-P3306-S/tmp/mysql. sock
In this way, the required MySQL is logged on. Solve the problem.