Backup and Restore MySQL Database Using mysqldump
Backup and Restore MySQL Database Using mysqldump
by Ramesh Natarajan on September 22, 2008ShareThis
[mysqldump - MySQL Backup & Restore]mysqldump is an effective tool to backup MySQL database. It creates a *.sql file with DROP table, CREATE table and INSERT into sql-statements of the source database. To restore the database, execute the *.sql file on destination database. For MyISAM, use mysqlhotcopy method that we explained earlier, as it is faster for MyISAM tables.
Using mysqldump, you can backup a local database and restore it on a remote database at the same time, using a single command. In this article, let us review several practical examples on how to use mysqldump to backup and restore.
For the impatient, here is the quick snippet of how backup and restore MySQL database using mysqldump:
backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql
How To Backup MySQL database
1. Backup a single database:
This example takes a backup of sugarcrm database and dumps the output to sugarcrm.sql
# mysqldump -u root -ptmppassword sugarcrm > sugarcrm.sql
# mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
The sugarcrm.sql will contain drop table, create table and insert command for all the tables in the sugarcrm database. Following is a partial output of sugarcrm.sql, showing the dump information of accounts_contacts table:
--
-- Table structure for table `accounts_contacts`
--
DROP TABLE IF EXISTS `accounts_contacts`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `accounts_contacts` (
`id` varchar(36) NOT NULL,
`contact_id` varchar(36) default NULL,
`account_id` varchar(36) default NULL,
`date_modified` datetime default NULL,
`deleted` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `idx_account_contact` (`ac
相关文档:
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
//===========================================
// 程序: mysql-Based Session Class
// 功能: 基于mysql存储的 Session 功能类
// 作者: yejr
// 网站: http://imysql.cn
// 时间: 2007- ......
该连接方式采用RPC来返回数据库查询结果。
1.首先是创建普通的GWT-EXT工程。可以参考1http://www.ibm.com/developerworks/cn/java/j-lo-gwtext1/#resources
系列 入 门 教程。具体通讯过程服务也可参考上述的最后部分说明。
2. 接下来就是要创建GWT Remote Service了,在原有工程上new-&g ......
Linux 编译安装 MYSQL 5.1 与 Innodb
编译mysql5
代码:
./configure \
--prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \
--with-extra-charsets=all \
--with-charset=utf8 \
- ......
方法一:
1.导出整个数据库
命令行进入到mysql安装目录的bin目录下
假设装在D:/mysql/bin
即:开始 运行 输入cmd
d:
cd mysql/bin
然后执行下面语句
mysqldump -u 用户名 -p 数据库名 > 导出的文件名
示例:mysqldump -u root -p sq_wcnc > d:\wcnc.sql
2.恢复数据库
常用source 命令 ......