mysql Error: Failed to open file “file_name” error 2/error 22

The web says that Linux may have this problem, and that the SQL file import error as shown in the title. I used Windows and had the same problem.
The reason is the same: mysql imports SQL according to the relative path query. For example, When I open mysql in the WWW folder, I enter source Form /test.sql to query the file in the WWW folder.
Solution: Simple, use CMD to enter the folder where SQL files exist, then open mysql, and then import SQL files

Read More: