Three, export the database file from the database: 1. Export the database mydb to the e:/mysql/mydb.sql file: Open Start->Run->enter cmd to enter command line mode c:/>mysqldump -h localhost -u root -p mydb >e:/mysql/mydb.sql Then enter the password and wait for a while before the export is successful. You can check whether it is successful in the target file. 2. Export mytable in the database mydb to the e:/mysql/mytable.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 e:/mysql/mydb_stru.sql file: c:/>mysqldump -h localhost -u root -p mydb --add-drop-table >e:/mysql/mydb_stru.sql Fourth, import data from external files into the database: Import the SQL statements in the file from e:/mysql/mydb2.sql into the database: 1. Enter mysql from the command line, and then use the command CREATE DATABASE mydb2; to create the database mydb2. 2. To exit mysql, you can enter the command exit; or quit; 3. Enter the following command in CMD: c:/>mysql -h localhost -u root -p mydb2 5. Solution to the import file size limit problem: By default: mysql has a limit on the size of the imported file, the maximum is 2M, so when the file is very large, it cannot be imported directly. Solution: 1. Modify relevant parameters in php.ini: There are three parameters that affect the size of mysql import files: memory_limit=128M,upload_max_filesize=2M,post_max_size=8M Modify upload_max_filesize=200 M. Modify the size here to meet your needs. You can modify the other two items at the same time memory_limit=250M post_max_size=200M In this way, you can import .sql files under 200M. |