sameersbn / docker-mysql

A Dockerfile that installs a mysql server
MIT License
246 stars 174 forks source link

How to execute a sql file by your means? #14

Closed rankun203 closed 9 years ago

rankun203 commented 9 years ago

Mount a file to the container? Maybe that's too complicate.

Like init scripts.

sameersbn commented 9 years ago

@rankun203 mounting the file or volume is one way of doing it. another way would be to add --volume=/run/mysqld:/run/mysqld to the run command to expose the mysql domain socket to the host. Now you can install mysql-client on your host and access the server in the container via the unix domain socket.

rankun203 commented 9 years ago

Thank you @sameersbn, That's also a way to achieve that. I add a user to mysql, and use a local mysql client to connect it through SSH :-)

I'm wondering if there is an easier way to init the database just after Docker build.

sameersbn commented 9 years ago

@rankun203 at the moment there is no way to specify an init script to initialize the database.