Home>

Developed with mac catalina + docker

Enter the mysql container installed with Docker
I want to import the sql file on the desktop with the mysql command.

If i execute the following, you will get a Failed to open file error.

mysql>source /users/username/desktop/table_field.sql;
ERROR:
Failed to open file'/users/username/desktop/table_field.sql', error: 2

Because the desktop is displayed when you go to/users/username/desktop/in the finder
I don't think the path is okay, but please let me know what to do

  • Answer # 1

    The host machine (mac) and docker container are images that do not share a disk.
    (It's just an image. Please study the detailed story.)

    Will you transfer the file with the docker cp command?
    Copy files from host to container with docker cp

    Mount the file using the volume option
    Using Volumes | Docker Documentation

    You need to do either.