Home > Database > Mysql Tutorial > 命令行CMD模式下备份MySQL数据库_MySQL

命令行CMD模式下备份MySQL数据库_MySQL

WBOY
Release: 2016-06-01 13:54:33
Original
1053 people have browsed it

    假设mysql 安装在c:盘,mysql数据库的用户名是root,密码是123456,数据库名是database_name,在d:盘根目录下面存放备份数据库,备份数据库名字为backup20070713.sql。

    备份数据库:

    mysqldump -uroot -p123456 database_name>d:/backup20070713.sql

    恢复数据库:删除原有数据库,建立数据库,把备份数据库导入。

    mysqladmin -uroot -p123456 drop database_name

    mysqladmin -uroot -p123456 create database_name

    mysql -uroot -p123456 database_name

    注:在导入备份数据库前,database_name如果没有,是需要创建的;而且与backup20070713.sql中数据库名是一样的才能导入。

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