How to Download MySQL and Load Dataset into your SQL database

Since pandasql is refusing to connect in Google Colab (to directly execute SQL queries on a pandas dataframe), we will set up our own SQL server in MySQL to query it. 

Here are the steps:

  1. Download MySQL for your machine. I used MySQL Installer 8.0.32, which is a .msi file (like an .exe that walks you through the installation process). There is another MySQL download that leads you to a .zip file, which is basically doing the same thing on hard mode since it doesn’t have that walkthrough process.
  2. I just kept it as Developer Default:
  3. There are Visual Studio requirements (below) that I apparently haven’t fulfilled yet, but MySQL seems to work properly even if we ignore it for now.
  4. Installation completed without errors:
  5. Keep the default settings:
  6. Pick and set a root password of your choice.
  7. Default settings:
  8. Check if it works within the installer:
  9. Click on Local instance MySQLServer and Log into your server on MySQL Workbench:
  10. So now we have a blank file. We now need to create a schema, and then import the CSV as a new table.
  11. To create a schema, right click anywhere in the white space of the “Schemas” tab and select New Schema.
  12. Type in the name of the schema that you want to call it. I called mine Uber cuz we’re going to pretend we are working with Uber rideshare datasets. Click Apply on the bottom right corner. You should now see “uber” as a schema on the left side. If you don’t, right click in the blank area on the left side under SCHEMAS and select “Refresh All”.
  13. Right click on “Tables” underneath Uber and click on Table Data Import Wizard.
  14. Import the data. I just called my table “trips”, so that when we reference it, it will be “SELECT * FROM uber.trips”.
  15. Right click on Tables and select “Refresh All”. That’s where the table is.
  16. Test out SELECT * FROM uber.trips to see if it works! It should!
    • Ctrl+Enter is the keyboard shortcut to run the query without using a mouse.
Share Share Tweet Email
Scroll to Top