Mysql Import Export SQL file brief analysis _mysql

Source: Internet
Author: User
Tags create database mysql command line mysql import

A. mysql command line mode settings

Desktop-> My Computer-> properties-> environment variable-> new->
Path= "; path\mysql\bin;" Where path is the installation path for MySQL.

Second, the command line to enter the MySQL method

1.c:\>mysql-h Hostname-u Username-p
Press ENTER to wait and then enter the password. Here hostname is the name of the server, such as the user name Localhost,username for MySQL, such as root.
After entering the command line, you can directly manipulate MySQL.
2. A brief description of the MySQL command:

  Mysql->create db dbname;//CREATE database
  mysql->create table tablename;//Create tables
  mysql->show databases;// Displays the database information and the databases that are available.
 mysql->use dbname;//Select the database
  mysql->show tables;//display table information, there are those available table
  Mysql->describe Displays information about the table that was created

Third, database export database files

1. Export the database mydb to the E:\mysql\mydb.sql file:
Open start-> run-> input cmd enter command line mode
C:\>mysqldump-h localhost-u root-p mydb >e:\mysql\mydb.sql
Then enter the password and wait for the export to succeed and check for success in the target file.
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

Iv. importing data from external files to the database

To import the SQL statements from the file into the database from E:\mysql\mydb2.sql:
1. Enter MySQL from the command line and use the command to create database mydb2; mydb2.
2. Exit MySQL to enter the command exit; or quit;
3. In cmd, enter the following command:

Copy Code code as follows:
C:\>mysql-h localhost-u root-p MYDB2 < E:\mysql\mydb2.sql

Then enter the password and it's OK.

Resolution of the import file size limit problem

By default: MySQL on the size of the import file limit, the largest 2M, so when the file is very large, directly unable to import, the following resolution of the problem listed below:
1. Modify the relevant parameters in PHP.ini:
There are three parameters that affect the size of the 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,
You can modify two other memory_limit=250m post_max_size=200m at the same time
This allows you to import the. sql files under 200M.

The above is about MySQL import export. sql file details, I hope to help you learn.

Related Article

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.