'command prompt does not allow me to use docker and mysql functions at the same time for creating an sql database in docker container
I start by saying that I am new to the docker and mysql functions for creating containers with a volume. In this case I need to import a .sql file called database_stage.sql, which is a database of a web page created by me through web hosting using the Pantheon service. I need to import this database from a folder on the desktop within the volume which is attached to my container in docker desktop. When I want to start this command through the command prompt, it opens the mysql help page for me. In addition I mention that I am not able to use both the docker and mysql functions together and I don't understand why. So my question is the following. Why don't you run the command to me, without showing some kind of error on the screen? the command line is as follows:
docker exec -i <my_ID_Container> mysql -u root -p password <db_name> < <database_to_import>
docker exec -i 816f46df4f59 mysql -uroot -psecret database_stage < cartella_database/database_stage.sql
todos is the name of my database taken inside my Docker-compose file.
below I am attaching some images of the command prompt:
command docker ps to explain the immage container ID
the command prompt explain me this:
Solution 1:[1]
I answer for myself because it can serve as an answer to someone else who will have this problem.I created another database using the mysql commands:
create database database_stage
and I created a folder specifically named database_folder in the docker.compose file directory
In which I moved the database_stage.sql file, then I changed the directory requested in the command after the sign < and I only received a warning because I set the password using the command.
I didn't understand the real problem but this is how it works ...
(I updated the code in the response with the current and working one)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |