DDD  ·  Before you start

Setting up DataGrip for MySQL

Laragon · MySQL · DataGrip · Windows 11 Do this once before DDD1 Approx 15 min
Before you start — check all three
  • Laragon is installed on this computer — your teacher has set this up. It provides a local MySQL server that runs on your machine.
  • DataGrip is installed — your teacher has set this up. DataGrip is the tool you will use to write and run SQL queries.
  • You have the SQL script file for your current lesson — download it from the lesson page. It will be named something like films.sql.

Setup steps

1

Start Laragon and turn on MySQL

Laragon provides the MySQL server that DataGrip connects to. You must start it first, every session.

  • a

    Click the Start button and search for Laragon, then click it to open. (There may also be a shortcut on the desktop.)

  • b

    The Laragon control panel opens. Click Start All.

  • c

    Wait a few seconds. The MySQL indicator must turn green before you continue.

Laragon 6
Apache ● ON
MySQL ● ON
Start All
MySQL must be green before you open DataGrip. If it stays red or orange, raise your hand — the MySQL service may need to be restarted by your teacher.
Laragon may minimise to the system tray (the small icons at the bottom-right of your taskbar) after starting. That is normal — it is still running in the background. Do not close it.
2

Open DataGrip

DataGrip is the database tool you will use to write and run SQL queries throughout the DDD unit.

  • a

    Click the Start button and search for DataGrip, then click it to open. (There may also be a desktop shortcut.)

  • b

    DataGrip may take 20–30 seconds to load. The splash screen shows the JetBrains logo while it starts up.

  • c

    If a welcome screen appears asking you to open or create a project, choose New Project. Name it N5 Computing Science and click Create.

3

Activate the licence First time only

DataGrip requires a licence. The school runs its own licence server — you connect to it once and DataGrip activates automatically. You will not be asked to pay for anything.

  • a

    If DataGrip asks how you want to activate, choose Licence Server.

  • b

    In the server address field, enter exactly:

https://jghs.fls.jetbrains.com
  • c

    Click Activate. DataGrip will connect to the school server and activate within a few seconds.

Already activated? If DataGrip opens straight to the main screen without asking for a licence, skip this step — you're already set up.
4

Connect DataGrip to MySQL First time only

You need to tell DataGrip where the MySQL server is. Because Laragon runs MySQL locally on this machine, the address is always localhost.

  • a

    Look at the Database Explorer panel on the left side of the screen. Click the + button at the top of that panel.

  • b

    From the menu that appears, choose Data SourceMySQL.

+ Data Source MySQL
  • c

    A Data Sources and Drivers dialog opens. Fill in the fields exactly as shown:

Host localhost Port 3306 User root Password (leave blank) Database (leave blank)
  • d

    If you see a yellow banner saying "Download missing driver files" — click it and wait for DataGrip to download the MySQL connector. This only happens once.

  • e

    Click Test Connection. You should see a green tick and the message "Successful". If it fails, check that Laragon's MySQL is still green (Step 1) and try again.

  • f

    Click OK to save the connection.

Next session: Once the connection is saved, DataGrip will remember it. From now on you just need to start Laragon and then open DataGrip — the connection will already be there.
5

Open and run the SQL script

The SQL script creates your database and loads all the data. You run it once per database. After that, the data is saved to your H drive and you do not need to run it again.

  • a

    Download the .sql file from your lesson page (e.g. films.sql) — it will save to your Downloads folder.

  • b

    In DataGrip, go to File › Open and navigate to your Downloads folder. Select the .sql file and click Open.

File Open…
  • c

    The SQL file opens as a tab in the editor. At the very top of that tab, look for a connection selector dropdown — it may say "No data source" or similar. Click it and choose your MySQL — localhost connection.

  • d

    Press Ctrl + A to select all the text in the file, then press Ctrl + Enter to run it. Alternatively, look for the Run button (a green triangle ▶) at the top of the editor and click it.

  • e

    Wait a few seconds. The output panel at the bottom should show a series of green ticks and completion messages — one for each statement in the script. No red error messages should appear.

Red error messages? The most common cause is that the wrong connection was selected in step (c), or MySQL is not running. Check Laragon first, then make sure the correct connection is selected at the top of the editor tab.
6

Refresh the Database Explorer and check

After the script runs, you need to refresh DataGrip's view so it shows the new database.

  • a

    In the Database Explorer panel on the left, right-click your MySQL — localhost connection and choose Refresh. (Or press Ctrl + R with the Explorer focused.)

  • b

    You should now see a database named films (or handball) listed underneath the connection.

  • c

    Click the arrow next to the database name to expand it, then expand tables. You should see two tables listed.

DataGrip — Database Explorer
MySQL — localhost
films
tables
director
film
Don't see the database? Make sure the script ran without errors in Step 5, then try the refresh again. If it still doesn't appear, raise your hand.
7

Browse the data — check the tables

Double-click a table name in the Database Explorer to open it in a data grid and see the records.

  • a

    Double-click director — you should see 15 rows, one per director.

  • b

    Double-click film — you should see 52 rows, one per film. Scroll right to see all 8 fields.

  • c

    Some cells in the runtime_mins column will show NULL — this is intentional and is something you will learn about in DDD1.

You're all set! If you can see data in both tables, the setup is complete. You can now start DDD1. Your database is stored on your H drive and will be there next lesson — you do not need to run the script again.
8

A quick look at the Query Console (you'll use this from DDD5)

The Query Console is where you type and run SQL queries. You won't need it until DDD5, but it is worth knowing where it is.

  • a

    In the Database Explorer, right-click the films database (the green square icon) and choose NewQuery Console.

  • b

    A blank SQL editor opens. Type the following and press Ctrl + Enter:

SELECT * FROM director;
  • c

    The results appear in the panel below the editor — you should see all 15 directors. This is how all SQL queries work in this unit.

Keyboard shortcut: Ctrl + Enter runs the query your cursor is on. If you want to run all queries in the console at once, select them all first (Ctrl + A) then press Ctrl + Enter.

Troubleshooting

✗  I can't find Laragon in the Start menu
Try clicking Start › All Apps and scrolling down to L. There may also be a Laragon shortcut on the desktop. If it isn't installed, let your teacher know.
✗  The MySQL indicator in Laragon stays red or won't start
Right-click the MySQL row in Laragon and choose Restart. If it still fails, another process may be using port 3306 — let your teacher know so they can check.
✗  DataGrip says "Connection refused" when I test the connection
MySQL is not running. Switch back to Laragon and make sure the MySQL indicator is green. Then return to DataGrip and click Test Connection again. Also check the Host is localhost and Port is 3306.
✗  I can't see the connection selector at the top of the SQL file tab
Look for a thin toolbar at the top of the editor area — it may say "<no data source>" or show a database icon. If you can't find it, try right-clicking in the editor and looking for "Change Query Context" or "Attach Session". Ask your teacher if you're unsure.
✗  I get red error messages when running the SQL script
Check that (1) MySQL is running in Laragon, and (2) you have selected the correct MySQL connection in the editor's connection selector. If the script ran partially before failing, right-click the MySQL connection in the Database Explorer, choose Refresh, and look for the partially created database — then re-run the full script.
✗  After refreshing I still don't see the database in Database Explorer
Try expanding the MySQL connection node by clicking the arrow next to it. Sometimes the database appears but the connection is collapsed. If it is still missing, the script may not have run correctly — check the output panel at the bottom for any red error messages and ask your teacher.
✗  director shows 0 rows / film shows 0 rows
The tables exist but the data was not inserted. This usually means the script was interrupted partway through. Re-run the full SQL script from Step 5 — the DROP TABLE IF EXISTS lines at the top will safely clear any partial data before re-creating everything.