##Very Light-weight mysql Container
Minimalistic container used as a base for a MySQL server. For use as a stand-alone with other containers. Runs on Alpine Linux, and at less than 20 mb, makes for an ideal db companion to a LAMP server container.
Comes with default database named "mysite," with all privileges granted to user "root" with no password required (you will probably want to change these defaults).
Fire up a mysql container and map an available port to 3306.
docker run -it --name database -p 49158:3306 -d kricker/mysql-base:latest
Now fire up a web server and link it to the mysql container we just started (for this example, I'll use a drupal application) and again map it to an available port on my host machine :
docker run -it --name drupalserver --link database:mysql -p 8080:80 kricker/drupal-base:latest
####Accessing the Database
With the port mapping of 49158:3306 as outlined above ... the database can be accessed via command line, or using the mysql gui tool of your choice (I like sequel pro personally). Just use "localhost" as the host, and whatever port we've assigned to 3306 (in the example above we used 49158).
host: 127.0.0.1 user: root password: database: mysite port: 49158
By default, there is a database set up named "mysite," with default user "root" and no password. WARNING: Probably not a good idea to keep that around if used on a live server. To disable this for a live environment, you'll want to delete the "mysite" db, and/or modify the mysql file located under:
# /root/initfile.mysql contents. Creates a "mysite" db with all privileges granted to user root from any ip CREATE DATABASE mysite; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;