Create Accessing the Database authored by Devin's avatar Devin
# Accessing the Database
There are two databases you can access:
- The one stored on the FRPG server
- The one stored on your machine
Regardless of which one you need to access, they are both running in a docker container. Accessing the database can be useful for re-initializing data for a new semester, and debugging why something works on your machine but doesn't on the server (by comparing both databases).
# Server
To access the FRPG server's database, you will need to first open an SSH tunnel to the server. You will need to get credentials from Dr. Wellington if you do not have them already.
Once you're in, run the following command:
- `docker exec -it frpg_mysql mysql`
This command runs the `mysql` command within the `frpg_mysql` Docker container, and gives control to you, so you can run `mysql` queries in the container.
You're in! From this point, you'll need a basic understanding of how to execute queries. [Here is a guide to get you started on some of the basics](https://dev.mysql.com/doc/mysql-tutorial-excerpt/8.0/en/entering-queries.html).
# Local
If you do not have Docker installed and setup with the FreshmanRPGSuite repository on your local machine, [follow this guide here](installing_docker).
Once you have the container running on your machine, you can do one of two things:
- Open a command prompt, and type `docker exec -it frpg_mysql mysql`
- Open Docker Desktop, click the 3 dots to the right of the container, and then click "`Open in terminal`".
You're in! From this point, you'll need a basic understanding of how to execute sql queries. [Here is a guide to get you started on some of the basics](https://dev.mysql.com/doc/mysql-tutorial-excerpt/8.0/en/entering-queries.html).