无法在mysql数据库中打开文件 [英] failed to open file in mysql database

查看:17
本文介绍了无法在mysql数据库中打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 github 下载了员工数据库,在其网站上推荐了 mysql,但在导入 .我该如何解决?我不认为它是损坏的数据库.错误是

i downloaded employees database from github that recommend mysql in its website but it has error in importing . how can i fix it? i dont think it is corrupt database.the error is

ERROR:
Failed to open file 'load_salaries1.dump', error: 2
ERROR:
Failed to open file 'load_salaries2.dump', error: 2
ERROR:
Failed to open file 'load_salaries3.dump', error: 2
ERROR:
Failed to open file 'show_elapsed.sql', error: 2

和我的参考 https://dev.mysql.com/doc/employee/en/employees-installation.html它也被添加到我的数据库中,但有这些错误

and my refrence https://dev.mysql.com/doc/employee/en/employees-installation.html and also it is added to my databases but with these errors

推荐答案

我遇到了类似的问题,这里是解决方案.

I faced a similar problem and here is the solution.

根本原因

employees.sql 脚本中转储文件的路径不是绝对的或相对的.

The path for the dump files in the employees.sql script is not absolute or relative.

如果您使用 IDE(例如 Visual Studio Code)打开 employees.sql 脚本,您会在其末尾找到以下 sql 命令.

If you open the employees.sql script with an IDE (say, Visual Studio Code), you would find the below sql commands at the end of it.

选择正在加载工资"作为信息";

SELECT 'LOADING salaries' as 'INFO';

源 load_salaries1.dump ;

source load_salaries1.dump ;

源 load_salaries2.dump ;

source load_salaries2.dump ;

源 load_salaries3.dump ;

source load_salaries3.dump ;

source show_elapsed.sql ;

source show_elapsed.sql ;

解决方案

只需添加文件的绝对路径并重新运行脚本文件.如下图:

Simply add the absolute path of the files and rerun the script file. Like below:

选择正在加载工资"作为信息";

SELECT 'LOADING salaries' as 'INFO';

源 C:/Users/abc/Downloads/test_db-master/load_salaries1.dump ;

source C:/Users/abc/Downloads/test_db-master/load_salaries1.dump ;

源 C:/Users/abc/Downloads/test_db-master/load_salaries2.dump ;

source C:/Users/abc/Downloads/test_db-master/load_salaries2.dump ;

源 C:/Users/abc/Downloads/test_db-master/load_salaries3.dump;

source C:/Users/abc/Downloads/test_db-master/load_salaries3.dump ;

源 C:/Users/abc/Downloads/test_db-master/show_elapsed.sql;

source C:/Users/abc/Downloads/test_db-master/show_elapsed.sql ;

注意 - 您可能还需要在employees.sql 脚本中为其他此类转储文件执行此操作

这篇关于无法在mysql数据库中打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆