Linux下MySQL整个数据库的备份与还原

WBOY
Release: 2016-06-07 16:53:18
Original
1120 people have browsed it

Linux下MySQL整个数据库的备份与还原[root]# /usr/bin/mysqldump -h127.0.0.1 -uusername -ppassword databasename gt;/opt/sha

Linux下MySQL整个数据库的备份与还原

[root]# /usr/bin/mysqldump -h127.0.0.1 -uusername -ppassword databasename >/opt/share/1/backup.sql

/usr/bin/mysqldump:用于执行的程序;

-h:主机名称

-u:数据库用户

-p:数据库密码

databasename:数据库名称

>/opt/share/1/backup.sql:导出文件的保存名称

以这样的方式导出的文件打开后发现里面有乱码,这个是正常的,,是因为导出时没有设置字体的缘故,这个不影响数据库内容的备份和还原。

然后使用

[root]# /usr/bin/mysql -h127.0.0.1 -uusername -ppassword databasename2 /share/1/backup.sql

导入数据到databasename2中

OK,完工!

linux

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!