Home > Database > Mysql Tutorial > linux下mysql数据的导出和导入_MySQL

linux下mysql数据的导出和导入_MySQL

WBOY
Release: 2016-06-01 13:02:10
Original
1136 people have browsed it

导出整个数据库中的所有数据

1、在linux命令行下输入:

mysqldump -u userName -p  dabaseName  > fileName.sql
Copy after login

fileName.sql最好加上路径名

导出数据库中的某个表的数据

mysqldump -u userName -p  dabaseName tableName > fileName.sql 
Copy after login

导出整个数据库中的所有的表结构

在linux命令行下输入:

mysqldump -u userName -p -d dabaseName  > fileName.sql
Copy after login

注意:是加了-d

导出整个数据库中某个表的表结构

在linux命令行下输入:

mysqldump -u userName -p -d dabaseName tableName > fileName.sql
Copy after login

注意:是加了-d

导入mysql方法1

进入linux命令命令行下:

mysql -uroot -p 回车  输入密码
source fileName.sql
注意fileName.sql要有路径名,例如:source /home/user/data/fileName.sql
Copy after login

导入mysql方法2

进入linux命令命令行下:

mysql -uroot -p database < fileName.sql
注意fileName.sql要有路径名
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template