This article is a detailed analysis of the import and export database commands in MySQL, as well as functions and stored procedures, which require a friend's reference:
MySQL Common Export Data command:
1.mysql exporting the entire database
Mysqldump-hhostname-uusername-ppassword databasename > Backupfile.sql
Mysqldump-hlocalhost-uroot hqgr> Hqgr.sql # (if the root user does not use the password can not write-p, of course, the exported SQL file you can develop a path, not specified in the MySQL bin directory)
2.mysql Export Database A table
Mysqldump-hhostname-uusername-ppassword Database tablename> #导出的文件名
Mysqldump-hlocalhost-uroot hqgr t_ug_user> User.sql
3.mysql Exporting 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 the export stored procedure;-R is a representation of the export function
MySQL commonly used to import data commands:
1.mysql command
Mysql-hhostname-uusername-ppassword DatabaseName < Backupfile.sql
2.source command
Mysql>source Backupfile.sql
[]mysql Import and Export database and description of functions and stored procedures