You are on page 1of 3

LAB 1: DATABASE CONNECTION

1 GETTING STARTED

1. Open PyCharm (PRO) application


2. Click Create New Project
3. Select a name for the project (instead of Untitled)
4. Click left bottom icon to view database tab

5. Click right hand side tab named “Database”


6. Click “+” to add database connection

7. Select Data Source > MySQL


a. Select a name for the connection
b. Host: studentlab1.rmit.edu.vn
c. Port: 3306
d. User and DB name: “sXXXXXXX” where XXXXXXX is your student id
e. Password: given by the lecturer (change it later!)

8. If needed, download and install the MySQL driver.


9. Click Test Connection, and, if successful, click OK.

2 CONNECT FROM OUTSIDE RMIT

1. Choose SSH/SSL tab


2. Choose Use SSH tunnel and click …
3. Click + and enter the following information

Note: User name is your RMIT id and Password is your RMIT account password
3. Make sure your firewall is properly configured
4. Check with ITS (firewall and proxy access)
3 CONNECT THROUGH PHPMYADMIN

1. Go to: https://studentlab1.rmit.edu.vn/phpmyadmin/index.php

2. User: “sXXXXXXX” where XXXXXXX is your student id

3. Password: given by the lecturer (change it! From the front page)

4. Click on the tab “SQL” at the top. Write your SQL commands in the text box and press “GO”.

4 CREATE SQL FILE AND STATEMENT EXECUTION

To create an SQL file in PyCharm:

1. Select New > File


2. Enter file name. Example: “myfile.sql”
3. You can write and save your SQL statements in this file

To execute a SQL statement you can select the statement and click the green “Play” button on the Editor.

You might also like