我正在尝试转储:服务器>数据导入>从自包含文件导入>然后选择我的dump.sql>开始导入并获取错误:
21:54:55恢复C:\ Users \ jonpr \ Desktop \ loja_cliente.sql
运行:“ C:\ Program Files \ MySQL \ MySQL Workbench 8.0 CE \ mysqldump.exe” --defaults-file =“ c:\ users \ jonpr \ appdata \ local \ temp \ tmpoaygw1.cnf” --protocol = tcp --host = localhost --user = root --port = 3306 --default-character-set = utf8 --comments <“ C:\ Users \ jonpr \ Desktop \ loja_cliente.sql”
mysqldump:得到错误:1049:选择数据库时未知数据库'<'
操作失败,退出代码为2
21:54:55 C:\ Users \ jonpr \ Desktop \ loja_cliente.sql的导入已完成,出现1个错误
我尝试将这段代码放在最顶层,但没有成功。
create database if not exists `loja` ;
use `loja`;`
我的转储文件知道:
-- MySQL dump 10.13 Distrib 5.7.24, for Win64 (x86_64)
--
-- Host: localhost Database: loja
-- ------------------------------------------------------
-- Server version 5.7.24
/*!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 `cliente`
--
DROP TABLE IF EXISTS `cliente`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cliente` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(60) NOT NULL,
`cpf` char(11) DEFAULT NULL,
`sexo` enum('m','f') DEFAULT NULL,
`endereco` varchar(60) DEFAULT NULL,
`telefone` varchar(15) DEFAULT NULL,
`nascimento` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `cliente`
--
LOCK TABLES `cliente` WRITE;
/*!40000 ALTER TABLE `cliente` DISABLE KEYS */;
INSERT INTO `cliente` VALUES (1,'jon','10609053612','m','rua n','31986473597','1993-08-14'),(2,'vanessa','10609053613','f','rua m','31321337','1992-06-21');
/*!40000 ALTER TABLE `cliente` 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 2019-02-08 18:49:51
答案 0 :(得分:0)
尝试此操作以备份特定数据库。
用您要备份的数据库名称替换db1
:
mysqldump -u username -p db1 --single-transaction --quick --lock-tables=false > db1-backup-$(date +%F).sql
答案 1 :(得分:0)
好吧,经过数小时的搜索,我找到了解决方案,如果"Preferences->Administration->Path to mysql Tool"
为空,则导入运行。