Several issues encountered in backing up and importing the MySQL database

Source: Internet
Author: User

First, how to export and backup

1, the common method, the use of tools or commands to export SQL script directly, take navicat as an example, directly select the database, dump the SQL file

Problem: Bad handling when there is a view or function execution fails

2. Separate export of view function and table data

Take Navicat as an example:

① Create a backup that includes views and tables: Click the backup directly below the database, and then create a new backup.

② after the completion of the production, directly select the extraction of SQL, extract can choose to be a table, view, or function, so that the table and the view foot off the

Second, after generating the export and backup of the SQL file is imported, here to solve the import process encountered several problems:

1. Error:mysql server has gone away

There are many reasons to report this mistake, the most probable one:

Your SQL query file is too large, you need to modify the MySQL configuration, directly under the MYSQLD node of the My.ini file to modify: max_allowed_packet=16777216 just fine.

2. error:the user specified as a definer (' root ' @ '% ') does not exist

This is due to insufficient permissions for the current user to execute some SQL, giving the current user all the permissions directly:

Grant all privileges on * * to [e-mail protected] "%" identified by ".";

Flush privileges;

Note: There is a possibility that multiple database dependencies and multiple views depend on each other during the import process, which adjusts the order of execution to complete the import correctly.

Several issues encountered in backing up and importing the MySQL database

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.