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
相关文档:
该连接方式采用RPC来返回数据库查询结果。
1.首先是创建普通的GWT-EXT工程。可以参考1http://www.ibm.com/developerworks/cn/java/j-lo-gwtext1/#resources
系列 入 门 教程。具体通讯过程服务也可参考上述的最后部分说明。
2. 接下来就是要创建GWT Remote Service了,在原有工程上new-&g ......
过了一阵子后,为了写分布式作业,重新使用Mysql时,发现虽然启动成功了,但是连接的时候去出现如下错误
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
根据提示是/var/run/mysqld/mysqld.sock文件不存在。
为什么会这样呢?
  ......
MySQL可以为不同的用户分配严格的、复杂的权限。这些操作大多都可以用SQL指令Grant(分配权限)和Revoke(回收权限)来实现。 Grant可以把指定的权限分配给特定的用户,如果这个用户不存在,则会创建一个用户。
Grant 常用格式:
grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 ide ......
所有的数学函数在一个出错的情况下返回NULL。
-
单目减。改变参数的符号。
mysql> select - 2;
注意,如果这个操作符与一个BIGINT使用,返回值是一个BIGINT!这意味着你应该避免在整数上使用-,那可能有值-2^63!
ABS(X)
返回X的绝对值。
mysql> select ABS(2);&n ......
要安裝 MySQL,可以在終端提示符后運行下列命令:
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install php5-mysql
// 安装php5-mysql 是将php和mysql连接起来
一旦安裝完成,MySQL 服務器應該自動啟動。您可以 ......