Phpmyadmin: import SQL files larger than 2 MB

Source: Internet
Author: User
Tags mysql import
Phpmyadmin: import SQL files larger than 2 MB

  1. Mysql-> create database dbname; // CREATE a DATABASE
  2. Mysql-> create table tablename; // CREATE a TABLE
  3. Mysql-> show databases; // displays the database information and available DATABASES.
  4. Mysql-> USE dbname; // select a database
  5. Mysql-> show tables; // displays the table information, available TABLES
  6. Mysql-> DESCRIBE tablename; // display the information of the created table

3. export database files from the 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. sql3. export the database mydb structure to the file "c:/mysql/mydb_stru. SQL": c:/> mysqldump-h localhost-u root-p mydb -- add-drop-table> e: /mysql/mydb_stru. SQL

4. import data from an external file 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. solution to the import file size limit: by default, mysql imposes a limit on the size of the imported file, which is at most 2 MB. Therefore, when the file is large, it cannot be imported directly.

Solution: 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_max_filesize = 200 M modify the size that meets your needs here, you can modify the other two memory_limit = 250 M post_max_size = 200 M

In this way, the. SQL file below MB can be imported.

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.