A simple MySQL Database Import backup,

Source: Internet
Author: User

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.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.