Export Database
--Export DBNAME table structure
mysqldump-uroot-p123456-d dbname > Dbname.sql
--Export dbname table data
Mysqldump-uroot-p123456-t dbname > Dbname.sql
--Export dbname table structure and data
mysqldump-uroot-p123456 dbname > Dbname.sql
To export a specified table in a database
--Export Test table structure under dbname
mysqldump-uroot-p123456-d dbname Test > Test.sql
--Export Test table data under dbname
Mysqldump-uroot-p123456-t dbname Test > Test.sql
--Export Test table structure and data under dbname
mysqldump-uroot-p123456 dbname Test > Test.sql
Restores
--Create a database
CREATE DATABASE dbname DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci;
--Restore Database
mysql-uroot-p123456 dbname </path/dbname.sql
--Restore Database
SOURCE Dbname.sql
--View table structure
Desc wp_users;
Show CREATE table Wp_users \g;
SELECT into outfile Export
SELECT * into outfile ' temp.txt '
FIELDS terminated by ', ' optionally enclosed by ' ' LINES terminated by ' \ n '
From table_name
WHERE Createtime < 1382716800;
LOAD DATA Import
LOAD DATA INFILE '/home/temp.txt '
INTO TABLE table_name
FIELDS terminated by ', ' optionally enclosed by ' ' LINES terminated by ' \ n '
(Product_id,uuid,mac,monitor,win_version,ip,createtime);
Note: Importing a remote server locally requires the load DATA local INFILE
Make sure that Local_infile is open and has permission to load data if it complains: Message:the used command isn't allowed with this MySQL version
1.MYSQL_CONNECT Specifies the fifth parameter 128 test, i.e. mysql_connect ($host, $user, $pwd, False, Client_local_files)
MySQL Extended version in 2.PHP