MySQL Import Export database and introduction to functions, stored procedures

Source: Internet
Author: User
Tags mysql in mysql export database mysql import
This article is a MySQL in the Import and export database commands as well as functions, stored procedures for a detailed analysis of the introduction, the need for friends under the reference

MySQL Common Export Data command:
1.mysql Export the entire database
mysqldump-hhostname-uusername-ppassword databasename > Backupfile.sql
Mysqldump-hlocalhost-uroot hqgr> Hqgr.sql (if the root user does not have a password to write-p, of course the exported SQL file you can make a path, unspecified then stored in the MySQL bin directory)

2.mysql Export Database A table
Mysqldump-hhostname-uusername-ppassword Database tablename> exported file name
Mysqldump-hlocalhost-uroot hqgr t_ug_user> User.sql

3.mysql Export a database structure
mysqldump-hhostname-uusername-ppassword-d--add-drop-table databasename>d:hqgrstructure.sql
-D No data--add-drop-table add a drop table before each CREATE statement

4. If you need to export a function or stored procedure inside MySQL
  MYSQLDUMP-HHOSTNAME-UUSERNAME-PPASSWORD-NTD -R databasename > Backupflie.sql
  mysqldump-hlocalhost-uroot-ntd-r hqgr > Hqgr.sql
 -NTD is an export stored procedure;-R is a command that represents the exported function

mysql common import data:
1.mysql command
  Mysql-hhostname -uusername-ppassword DatabaseName < Backupfile.sql
2.source command
  MySQL >source Backupfile.sql

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.