Home > Backend Development > PHP Tutorial > phpmyadmin imports SQL files larger than 2M

phpmyadmin imports SQL files larger than 2M

WBOY
Release: 2016-07-25 08:55:53
Original
1037 people have browsed it
  1. mysql->CREATE DATABASE dbname;//Create database
  2. mysql->CREATE TABLE tablename;//Create table
  3. mysql->SHOW DATABASES;//Display database information and those available databases.
  4. mysql->USE dbname;//Select database
  5. mysql->SHOW TABLES;//Display table information, which tables are available
  6. mysql->DESCRIBE tablename;//Display information about created tables
Copy the code

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.



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template