Skip to content

Running SQL queries

Steve Azzopardi edited this page Oct 26, 2015 · 1 revision

When you have docker all of your docker images running by using $ sudo docker-compose up, inside of the root directory of your Laravel installation.

If you $ sudo docker ps you will see all of the current containers that you have running, by theory you should have 5 containers running like the following.

CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                    NAMES
1143d6f1436a        steveazz/laravel-commands   "/sbin/my_init"          22 hours ago        Up 8 minutes                                 laravel_laravel-commands_1
5ed2bc678141        steveazz/nginx              "/sbin/my_init"          22 hours ago        Up 8 minutes        127.0.0.1:8080->80/tcp   laravel_web_1
30936abeba1d        nmcteam/php56               "/sbin/my_init"          22 hours ago        Up 8 minutes        9000/tcp                 laravel_php_1
8cdeb242c852        sameersbn/mysql             "/sbin/entrypoint.sh "   22 hours ago        Up 8 minutes        3306/tcp                 laravel_db_1
742ab3d8e3e1        steveazz/gulp               "/sbin/my_init"          22 hours ago        Up 8 minutes                                 laravel_gulp_1
                                                                                                                                                             

You will have to ssh into the laravel-commands to do this you have to run the following command sudo docker exec -it CONTAINERID /bin/bash, in our case we have to run the following :

$ sudo docker exec -it 8cdeb242c852 /bin/bash

When you are loged inside of your container all you need to do is log into mysql for example

$ mysql -u laravel -p

This will prompt you for the password which by default is 'laravel', information about this can be found here

Clone this wiki locally