MySQL:错误:无法打开文件error2

MySQL:错误:无法打开文件error2,mysql,Mysql,以下是我的步骤: 1.使用银行(我的数据库) 2.源d:\Nitro\testing\SQL\Books\u mysql\Cookbook\recipes\tables\cow.SQL 当我尝试为特定的.sql文件(即“cow.sql”)寻找源代码时,显示以下错误: 错误: 无法打开文件“d:\Nitro\testing\SQL\Books\u mysql\Cookbook\recipes\tables\cow.SQL”,错误:2 “cow.sql”的内容: #在线施工牛订购场景表 DROP T

以下是我的步骤:
1.使用银行(我的数据库)
2.源d:\Nitro\testing\SQL\Books\u mysql\Cookbook\recipes\tables\cow.SQL

当我尝试为特定的.sql文件(即“cow.sql”)寻找源代码时,显示以下错误:

错误:
无法打开文件“d:\Nitro\testing\SQL\Books\u mysql\Cookbook\recipes\tables\cow.SQL”,错误:2

“cow.sql”的内容: #在线施工牛订购场景表

DROP TABLE IF EXISTS cow_order;
#@ _CREATE_COW_ORDER_TABLE_
CREATE TABLE cow_order
(
 id          INT UNSIGNED NOT NULL AUTO_INCREMENT,
 # cow color, figurine size, and accessory items
 color VARCHAR(20),
 size ENUM('small','medium','large') DEFAULT 'medium',
 accessories SET('cow bell','horns','nose ring','tail ribbon')
              DEFAULT 'cow bell,horns',
 # customer name, street, city, and state (abbreviation)
 cust_name   VARCHAR(40),
 cust_street VARCHAR(40),
 cust_city   VARCHAR(40),
 cust_state  CHAR(2),
 PRIMARY KEY (id)
 );
 #@ _CREATE_COW_ORDER_TABLE_

 # Add some orders to the table

 INSERT INTO cow_order (color, size, accessories,
                   cust_name, cust_street, cust_city, cust_state)
 VALUES
 ('Black & White','large','cow bell,nose ring',
 'Farmer Brown','123 Elm St.','Bald Knob','AR');

 SELECT * FROM cow_order\G

 DROP TABLE IF EXISTS cow_color;
 #@ _CREATE_COW_COLOR_TABLE_
 CREATE TABLE cow_color (color CHAR(20));
 #@ _CREATE_COW_COLOR_TABLE_

 INSERT INTO cow_color (color)
 VALUES
 ('Black'),
 ('Brown'),
 ('Cream'),
 ('Black & White'),
 ('Red & White'),
 ('Red'),
 ('See-Through');

 SELECT * FROM cow_color;

你好像在窗户上。在这里你需要使用正斜杠

USE bank;

SOURCE D:/Nitro/testing/SQL/Books_mysql/Cookbook/recipes/tables/cow.sql;
或者,可以使用转义反斜杠:

SOURCE D:\\Nitro\\testing\\SQL\\Books_mysql\\Cookbook\\recipes\\tables\\cow.sql;

在Windows上,在路径中使用正斜杠(/),并提供完整路径。 例如:


source C:/wamp64/bin/mariadb/mariadb10.4.10/bin/goblissl_oc.sql

您可以发布cow.sql的内容吗?您不能在路径周围加引号。并且该文件必须存在于给定的位置,并且必须能够被mysql进程读取。我没有使用任何引号,并且该文件通常由mysql进程在使用以下命令时读取:
mysql bank
。完成了……这是我的任务错误…
d:\Nitro\Саааааааааааааааааааа1072。当我使用这个
d:\Nitro\testing\SQL\Books\u mysql\Cookbook\recipes\tables\cow.SQL
并用英语写俄语单词“аааааааааа”。谢谢你的帮助!我很高兴它成功了。如果您的问题完全解决了,请不要忘记投票并接受答案。此外,源命令必须以分号结尾,如上所示。