Lesson Weekend

MySQL is a type of database software used to create, edit, query, and manage SQL data.

Installing MySQL

Follow the installation instructions below. We're going to installing two programs: MySQL Community Server and MySQL Workbench.


MacOS

Start by downloading the MySQL Community Server .dmg file from the MySQL Community Server page. Click the download icon. Use the No thanks, just start my download link.

Next, follow along with the Installer until you reach the Configuration page. Once you've reached Configuration, select or set the following options (use default if not specified):

  • Use Legacy Password Encryption.
  • Set password to epicodus. You can use your own password if you want but epicodus will be assumed in the lessons.
  • Click Finish.
  • Open the terminal and enter the command echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.bash_profile. This will save this path in .bash_profile, which is where our terminal is configured.
  • Type in source ~/.bash_profile (or restart the terminal) in order to actually verify that MySQL was installed.

Next, verify MySQL installation by opening terminal and entering the command mysql -uroot -pepicodus. You'll know it's working and connected if you gain access and see the MySQL command line. If it's not working, you'll likely get a -bash: mysql: command not found error.

You can exit the mysql program by entering exit.

Next, download the MySQL Workbench .dmg file from the MySQL Workbench page. (Use the No thanks, just start my download link.)

Install MySQL Workbench to Applications folder.

Then open MySQL Workbench and select the Local instance 3306 server. You will need to enter the password you set. (We used epicodus.) If it connects, you're all set.


Windows 10

Start by downloading the MySQL Web Installer from the MySQL Downloads page.

Follow along with the installer:

  • Click "Yes" if prompted to update.
  • Accept license terms.
  • Choose Custom setup type.
  • When prompted to Select Products and Features, choose the following:
    • Check the box that says "Enable the Select Features page to customize product features".
    • MySQL Server 8.0.19 (This will be under "MySQL Servers > MySQL Server > MySQL Server 8.0")
    • MySQL Workbench 8.0.19 (This will be under "Applications > MySQL Workbench > MySQL Workbench 8.0")
  • Select "Next", then "Execute". Wait for download and installation. (This can take a few minutes.)
  • Advance through Configuration as follows:
    • High Availability set to "Standalone".
    • "Defaults are OK" under Type and Networking.
    • Authentication Method set to Use Legacy Authentication Method.
    • Set password to epicodus. You can use your own if you want but epicodus will be assumed in the lessons.
    • Defaults are OK under Windows Service. Make sure that checkboxes are checked for the options "Configure MySQL Server as a Windows Service" and "Start the MySQL Server at System Startup". Under Run Windows Service as..., the "Standard System Account" should be selected.
  • Complete Installation process.

Next, add the MySQL environment variable to the System PATH. We must include MySQL in the System Environment Path Variable. This is its own multi-step process:

  • Open the Control Panel and visit System and "Security > System". Select "Change Settings" and a pop-up window will display. Select the tab "Advanced" and select the "Environment Variables" button.
  • Within the System Variables navigator window, select PATH..., click Edit..., and then New.
  • Add the exact location of your MySQL installation, and click OK. (This location is likely C:\Program Files\MySQL\MySQL Server 8.0\bin, but may differ depending on your specific installation.)

Next, verify installation by opening Windows PowerShell and entering the command mysql -uroot -pepicodus. You'll know it's working and connected if you gain access and see MySQL's command line. You can exit the mysql program by entering exit.

Finally, open MySQL Workbench and select the Local instance 3306 server (it may have a different name). You will need to enter the password you set (We used epicodus). If it connects, you're all set.

Lesson 4 of 5
Last updated February 23, 2021