mysql 数据库导出与导入

来源:互联网 发布:北大软禁季羡林 知乎 编辑:程序博客网 时间:2024/05/16 03:38
➜  ~  mysqldump -u jinqiang -p test > test_dump.sqlEnter password: ➜  ~  cat test_dump.sql                            -- MySQL dump 10.13  Distrib 5.5.37, for debian-linux-gnu (i686)---- Host: localhost    Database: test-- -------------------------------------------------------- Server version<span style="white-space:pre"></span>5.5.37-0ubuntu0.14.04.1/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;/*!40101 SET NAMES utf8 */;/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;/*!40103 SET TIME_ZONE='+00:00' */;/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;---- Table structure for table `SpiderTable`--DROP TABLE IF EXISTS `SpiderTable`;/*!40101 SET @saved_cs_client     = @@character_set_client */;/*!40101 SET character_set_client = utf8 */;CREATE TABLE `SpiderTable` (  `Url` text NOT NULL,  `Title` text NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;/*!40101 SET character_set_client = @saved_cs_client */;---- Dumping data for table `SpiderTable`--LOCK TABLES `SpiderTable` WRITE;/*!40000 ALTER TABLE `SpiderTable` DISABLE KEYS */;/*!40000 ALTER TABLE `SpiderTable` ENABLE KEYS */;UNLOCK TABLES;---- Table structure for table `employee`--DROP TABLE IF EXISTS `employee`;/*!40101 SET @saved_cs_client     = @@character_set_client */;/*!40101 SET character_set_client = utf8 */;CREATE TABLE `employee` (  `id` int(11) NOT NULL,  `name` varchar(30) DEFAULT NULL,  `password` varchar(30) NOT NULL DEFAULT 'passwd',  `email` varchar(100) DEFAULT NULL,  PRIMARY KEY (`id`),  UNIQUE KEY `id` (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;/*!40101 SET character_set_client = @saved_cs_client */;---- Dumping data for table `employee`--LOCK TABLES `employee` WRITE;/*!40000 ALTER TABLE `employee` DISABLE KEYS */;INSERT INTO `employee` VALUES (0,'jinqiang','123456789','hellojinqiang@gmail.com'),(1,'jinqiang','123456789','hellojinqiang@gmail.com');/*!40000 ALTER TABLE `employee` ENABLE KEYS */;UNLOCK TABLES;---- Table structure for table `t_user`--DROP TABLE IF EXISTS `t_user`;/*!40101 SET @saved_cs_client     = @@character_set_client */;/*!40101 SET character_set_client = utf8 */;CREATE TABLE `t_user` (  `userid` int(10) unsigned NOT NULL AUTO_INCREMENT,  `username` varchar(255) DEFAULT NULL,  `email` varchar(255) DEFAULT NULL,  `password` varchar(255) DEFAULT NULL,  PRIMARY KEY (`userid`),  UNIQUE KEY `userid_4` (`userid`),  KEY `userid` (`userid`),  KEY `userid_2` (`userid`),  KEY `userid_3` (`userid`)) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;/*!40101 SET character_set_client = @saved_cs_client */;---- Dumping data for table `t_user`--LOCK TABLES `t_user` WRITE;/*!40000 ALTER TABLE `t_user` DISABLE KEYS */;INSERT INTO `t_user` VALUES (1,'huangjinqiang','hellojinqiang@gmail.com','123456'),(2,'huang','jin@qiang.com','123456'),(3,'huangjinqiang','ligelaige@qq.com','123456'),(4,'wuheng','wenhuang@li.com','123456'),(5,'keng','keng@die.com','123456'),(6,'dakeng','bigkeng@die.com','123456'),(9,'jiang','jiang@linux.com','123456'),(13,'jinqiang','jinqiang@linux.com','123456');/*!40000 ALTER TABLE `t_user` ENABLE KEYS */;UNLOCK TABLES;/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;-- Dump completed on 2014-05-15 20:19:33➜  ~    ➜  ~  mysql -u jinqiang -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 120Server version: 5.5.37-0ubuntu0.14.04.1 (Ubuntu)Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> source /home/jiang/test_dump.sql;Query OK, 0 rows affected (0.03 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.01 sec)Query OK, 0 rows affected (0.01 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)ERROR 1046 (3D000): No database selectedQuery OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.01 sec)ERROR 1046 (3D000): No database selectedQuery OK, 0 rows affected (0.00 sec)ERROR 1046 (3D000): No database selectedERROR 1046 (3D000): No database selectedERROR 1046 (3D000): No database selectedQuery OK, 0 rows affected (0.00 sec)ERROR 1046 (3D000): No database selectedQuery OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)ERROR 1046 (3D000): No database selectedQuery OK, 0 rows affected (0.00 sec)ERROR 1046 (3D000): No database selectedERROR 1046 (3D000): No database selectedERROR 1046 (3D000): No database selectedERROR 1046 (3D000): No database selectedQuery OK, 0 rows affected (0.00 sec)ERROR 1046 (3D000): No database selectedQuery OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)ERROR 1046 (3D000): No database selectedQuery OK, 0 rows affected (0.00 sec)ERROR 1046 (3D000): No database selectedERROR 1046 (3D000): No database selectedERROR 1046 (3D000): No database selectedERROR 1046 (3D000): No database selectedQuery OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.03 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.02 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)mysql> quit;Bye

0 0
原创粉丝点击