When deploying your Graphcool service locally with Docker, it is possible to send SQL queries directly against the connected MySQL database.
Follow these steps to open the MySQL client in your terminal.
In the following, we assume that you have a local Graphcool service running (as described in the previous chapter).
In the root directory of your locally deplopyed Graphcool service, run the following command:
docker ps --filter name=local_graphcool-db
docker ps lists all running Docker containers. In this case, you're also adding a filter to ask for a specific Docker container whose name starts with the string
The output contains several columns with properties about the Docker containers. You need to copy the output for the
NAME column and use it in the next step.
Note: In case no containers are printed, remove the filter and choose the Docker container that has the
To open the MySQL client in your terminal, run the following command. Note that you need to replace the placeholder
__CONTAINER_NAME__ with the container name from the previous step:
docker exec -it __CONTAINER_NAME__ mysql -u root --host 127.0.0.1 --port 3306 --password=graphcool
Once the MySQL client is open, you can ask for the currently available databases:
This will print the following output:
+---------------------------+ | Database | +---------------------------+ | information_schema | | graphcool-framework | | logs | | mysql | | performance_schema | | sys | | <service-id> | +---------------------------+
From the available databases, the following three are relevant for you:
<service-id>: The name of this database is the ID of your service (Note that
<service-id>is a placeholder for a string consisting of 25 alphanumeric characters). It contains your application data (each
@modeltype from your data model lives as one dedicated table in that database).
graphcool: This database contains meta-information about the Graphcool service definition.
logs: This database contains the logs from your integrated functions.
You can now select one of these databases with the
use command, for example if your
cj9u6bssn00040156c8optc3e, then run:
Was this page helpful?