Heim > Datenbank > MySQL-Tutorial > Mysql数据导入导出_MySQL

Mysql数据导入导出_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Freigeben: 2016-06-01 13:49:17
Original
987 Leute haben es durchsucht

bitsCN.com

导出导入数据库
导出
mysqldump方法
mysqldump -u用户名 -p密码名 database [table]> 目标文件
导入
mysql -uroot -proot
use database
source 目标文件;
photoshop/ target=_blank class=infotextkey>PS: 这种方法是导出整个表数据,并且带着建表信息,假如导入的数据库有同名的表,会被替换
photoshop/ target=_blank class=infotextkey>PS: 可以添加条件
mysql -uroot -proot [-n] [-t] [-d] database [table]>name
-t 不包含创建表的信息
-d不包含数据信息
--w or -w筛选条件

1 例:先进入dos cmd命令模式 Ctrl旁边的键+R 2 导出 mysqldump -uroot -proot test student -t -w studentno=10101 >stu3 导入 mysql -uroot -proot4      mysql>use test5      mysql>source stu
Nach dem Login kopieren

 

方法二
into outfile
load data infile

例子导出mysql -uroot -prootmysql>use testmysql>select * from student where studentno=10101 into outfile './stu';导入mysql -uroot -prootmysql>use testmysql>load data infile './stu' into table student;
Nach dem Login kopieren

 

导出xmlmysqldump --xml -uroot -proot [database] [table]> name.xml[test]mysqldump --xml -uroot -proot test>a.xmlmysqldump --xml -uroot -proot test dept>a.xmlmysql -X -uroot -proot -e "use test;select * from dept">a.xml[方法2]导入xml文件内容到数据库mysql> create table xmlt( -> id int , -> doc blob -> );mysql> insert into xmlt values(1,load_file('/home/a.xml') );mysql> select * from xmlt;
Nach dem Login kopieren

10:23:39

bitsCN.com
Verwandte Etiketten:
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage