在我短暂的开发人员生活中,我使用 Workbench 管理了我的 MySQL,原因是在没有数据库管理专业知识的情况下真正使我的开发过程变得可行。在我参与的最后一个项目中,在构建我的应用程序后,我将每个模块(微服务)设置在 docker 容器的映像上,并且由于该项目由关系数据库管理,因此我还提取了一个 mysql 映像。完成此操作后,我创建了我的测试数据库(包含所有表的转储文件夹)的副本,以便在容器设置为运行后导入到我的新 mysqldocker 映像中。 但是由于某种原因,当我尝试将之前导出的所有数据导入到正在运行的 mysql docker 容器中时,我仍然无法理解,每个表的这个错误都会显示:
Operation failed with exitcode 1
14:05:57 Restoring multirenter (product_subtype)
Running: mysql.exe --defaults-file="c:\users\kikit\appdata\local\temp\tmp377gxw.cnf" --protocol=tcp --host=127.0.0.1 --user=root --port=3306 --default-character-set=utf8 --comments --database=multirenter < "C:\\Users\\kikit\\Documents\\dumps\\Dump20210226\\multirenter_product_subtype.sql"
ERROR 1146 (42S02) at line 22: Table 'multirenter.product_subtype' doesn't exist
Operation failed with exitcode 1
14:05:58 Restoring multirenter (product_type)
Running: mysql.exe --defaults-file="c:\users\kikit\appdata\local\temp\tmph0b0bt.cnf" --protocol=tcp --host=127.0.0.1 --user=root --port=3306 --default-character-set=utf8 --comments --database=multirenter < "C:\\Users\\kikit\\Documents\\dumps\\Dump20210226\\multirenter_product_type.sql"
ERROR 1146 (42S02) at line 22: Table 'multirenter.product_type' doesn't exist
Operation failed with exitcode 1
14:05:59 Restoring multirenter (rent)
Running: mysql.exe --defaults-file="c:\users\kikit\appdata\local\temp\tmpycsq97.cnf" --protocol=tcp --host=127.0.0.1 --user=root --port=3306 --default-character-set=utf8 --comments --database=multirenter < "C:\\Users\\kikit\\Documents\\dumps\\Dump20210226\\multirenter_rent.sql"
ERROR 1146 (42S02) at line 22: Table 'multirenter.rent' doesn't exist
Operation failed with exitcode 1
14:06:00 Restoring multirenter (rent_notification)
Running: mysql.exe --defaults-file="c:\users\kikit\appdata\local\temp\tmposezhe.cnf" --protocol=tcp --host=127.0.0.1 --user=root --port=3306 --default-character-set=utf8 --comments --database=multirenter < "C:\\Users\\kikit\\Documents\\dumps\\Dump20210226\\multirenter_rent_notification.sql"
ERROR 1146 (42S02) at line 22: Table 'multirenter.rent_notification' doesn't exist
Operation failed with exitcode 1
14:06:01 Restoring multirenter (renter)
Running: mysql.exe --defaults-file="c:\users\kikit\appdata\local\temp\tmpi0zamm.cnf" --protocol=tcp --host=127.0.0.1 --user=root --port=3306 --default-character-set=utf8 --comments --database=multirenter < "C:\\Users\\kikit\\Documents\\dumps\\Dump20210226\\multirenter_renter.sql"
ERROR 1146 (42S02) at line 22: Table 'multirenter.renter' doesn't exist
Operation failed with exitcode 1
14:06:02 Restoring multirenter (renter_role)
Running: mysql.exe --defaults-file="c:\users\kikit\appdata\local\temp\tmpxrcppi.cnf" --protocol=tcp --host=127.0.0.1 --user=root --port=3306 --default-character-set=utf8 --comments --database=multirenter < "C:\\Users\\kikit\\Documents\\dumps\\Dump20210226\\multirenter_renter_role.sql"
ERROR 1146 (42S02) at line 22: Table 'multirenter.renter_role' doesn't exist
Operation failed with exitcode 1
14:06:03 Restoring multirenter (role)
Running: mysql.exe --defaults-file="c:\users\kikit\appdata\local\temp\tmpa9imev.cnf" --protocol=tcp --host=127.0.0.1 --user=root --port=3306 --default-character-set=utf8 --comments --database=multirenter < "C:\\Users\\kikit\\Documents\\dumps\\Dump20210226\\multirenter_role.sql"
ERROR 1146 (42S02) at line 22: Table 'multirenter.role' doesn't exist
Operation failed with exitcode 1
14:06:04 Import of C:\Users\kikit\Documents\dumps\Dump20210226 has finished with 13 errors
显然无法识别导入所有表的文件夹。我到了目录,我检查了那里的每一个表,它们都包含相应的数据,例如产品表:
-- MySQL dump 10.13 Distrib 8.0.20, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: multirenter
-- ------------------------------------------------------
-- Server version 8.0.20
/*!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 */;
/*!50503 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 */;
--
-- Dumping data for table `product`
--
LOCK TABLES `product` WRITE;
/*!40000 ALTER TABLE `product` DISABLE KEYS */;
INSERT INTO `product` VALUES (6,'Roller Blade 1',9,1,1,1,1,1),(9,'Periquito',8,4,2,1,2,2),(10,'chanclas',8,3,2,2,2,3),(11,'product test 1',8,3,2,2,2,3),(12,'product test 2',8,4,2,2,2,2),(13,'Blazer Roller Blades',8,1,1,2,1,1),(14,'Blazer Roller Blades',8,1,1,2,1,1),(15,'Roller Blades Bazer 11',8,1,1,2,1,1),(16,'Surf Board Hawai 2.0',8,28,4,2,3,3);
/*!40000 ALTER TABLE `product` 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 2021-02-26 13:36:50
图像数据库运行良好,因此我放弃了没有运行数据库的任何问题。还测试了连接工作正常:
我一直使用 MYSQl 的 Workbench 来处理这种导入和导出数据库以及使用的情况,因为我不是关系数据库方面的专家。一些身体可以帮助我吗?