Mysql Imports and Exports table structures and table data and executes SQL files

Source: Internet
Author: User
Tags mysql import

Mysql imports and exports the table structure and table data and executes the SQL file. Execute the SQL FILE command in mysql: source d: \ myprogram \ database \ db. SQL; Connect to MYSQL: mysql-h host address-u user name-p User password Change password: mysqladmin-u user name-p old password new password export database file from database: 1. export the database mydb to e: \ MySQL \ mydb. in the SQL file: Open start> RUN> Enter cmd to enter Command Line Mode c: \> MySQLdump-h localhost-u root-p mydb> e: \ MySQL \ mydb. then, enter the password and wait for a moment until the export is successful. You can check whether the export is successful in the target file. 2. export mytable from mydb to e: \ MySQL \ mytable. in the SQL file: c :\> MySQLdump-h localhost-u root-p mydb mytable> e: \ MySQL \ mytable. SQL 3. export the structure of the database mydb to the file c: \ MySQL \ mydb_stru. SQL: \> MySQLdump-h localhost-u root-p mydb -- add-drop-table> e: \ MySQL \ mydb_stru. SQL-h localhost can be omitted, which is generally used on a VM. import data from the external file MySQL to the database: import the SQL statements in the file into the database from e: \ MySQL \ mydb2. SQL: 1. enter MySQL from the command line, and then run the create database mydb2 command to CREATE the DATABASE mydb2. 2. to exit MySQL, run exit or quit. 3. run the following command in CMD: c: \> MySQL-h localhost-u root-p mydb2 <e: \ MySQL \ mydb2. SQL and then enter the password. 5. next, let's talk about how to solve the import file size restriction problem: by default, the maximum size of the MySQL imported file is 2 MB. Therefore, when the file is large, it cannot be imported directly, the solution to this problem is as follows: 1. in php. modify related parameters in ini: There are three parameters that affect the MySQL import file size: memory_limit = 128 M, upload_max_filesize = 2 M, post_max_size = 8 M modify upload _......

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.