Re: Migrating mySQL DB From Ubuntu Host to Docker
Posted by: Lars Tangvald
Date: May 09, 2018 02:52AM

Hi,

One thing to note first: The docker image just named "mysql" is maintained by Docker, not Oracle. The Oracle-maintained image is named "mysql/mysql-server". They largely have the same features, but may differ in some ways.

As for the database import, you don't actually have to do anything for that aside from copying over the database files (plus any custom config you might be using). We don't recommend actually storing data inside the container, but instead mapping the database location to one on the host. There's some detailed information about it here: https://dev.mysql.com/doc/refman/8.0/en/docker-mysql-more-topics.html#docker-persisting-data-configuration

Say you have the data copied to a location /somepath/mysqldata on your Docker host, then in step 2 above simply add the following after "docker run":
-v /somepath/mysqldata:/var/lib/mysql
(The MYSQL_ROOT_PASSWORD option is not needed when starting up with an existing database)

You should now be able to log in with ┬źdocker exec -it some-mysql mysql -uroot -p┬╗

Options: ReplyQuote


Subject
Written By
Posted
Re: Migrating mySQL DB From Ubuntu Host to Docker
May 09, 2018 02:52AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.