MySQL import export. sql file

Source: Internet
Author: User
Tags mysql import

One. mysql command-line mode settings:
Desktop, My Computer, properties, environment variables, new
Path= "; path\mysql\bin;" Where path is the installation path for MySQL.
Two. A simple introduction to the command line into the MySQL method:
1.c:\>mysql-h Hostname-u Username-p
Press ENTER, wait and enter the password. Here hostname is the name of the server, such as localhost,username as the MySQL username, such as root.
MySQL can be manipulated directly after entering the command line.
2. Simply introduce the MySQL command:
Mysql->create database dbname;//Creating databases
Mysql->create table tablename;//Creating tables
Mysql->show databases;//Displays database information, which databases are available.
Mysql->use dbname;//Select a database
Mysql->show tables;//display table information, which tables are available
Mysql->describe tablename;//Display information for the created table
Three. Export the database file from the database:
1. Export the database mydb to the E:\mysql\mydb.sql file:
Open Start-to-run input cmd enter command-line mode
C:\>mysqldump-h localhost-u root-p mydb >e:\mysql\mydb.sql
Then enter the password, wait for an export to succeed, you can check the target file for success.
2. Export the 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
Four. Import data from an external file into the database:
Import the SQL statements from the file into the database from E:\mysql\mydb2.sql:
1. Go to MySQL from the command line and create database mydb2 with the command; mydb2.
2. Exit MySQL to enter the command exit, or quit;
3. Enter the following command in CMD:
C:\>mysql-h localhost-u root-p MYDB2 < E:\mysql\mydb2.sql
Then enter the password and it's OK.
Five. Let's talk about the resolution of the import file size limit issue:
By default: MySQL has a limit to the size of the import file, the maximum is 2M, so when the file is very large, directly unable to import, the following resolution of the problem is listed as follows:
1. Modify the relevant parameters in PHP.ini:
There are three parameters that affect the size of a MySQL import file:
Memory_limit=128m,upload_max_filesize=2m,post_max_size=8m
Modify upload_max_filesize=200 M Here to modify the size that meets your needs,
Two other memory_limit=250m can be modified at the same time post_max_size=200m
This allows you to import. sql files that are below 200M.

Reprinted from Http://www.cnblogs.com/cnkenny/archive/2009/04/22/1441297.html

MySQL import export. sql file

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.