MySQL is a type of database software used to create, edit, query, and manage SQL data.
Follow the installation instructions below. We're going to installing two programs: MySQL Community Server and MySQL Workbench.
Start by downloading the MySQL Community Server .dmg
file from the MySQL Community Server page:
Students with High Sierra or Mojave should use this link. Scroll down and click the No thanks, just start my download link.
Students with Catalina, Big Sur, Monterey or a newer OS and an Intel chip should use this link. Scroll down and click the No thanks, just start my download link.
Students with Catalina, Big Sur, Monterey or a newer OS and an M1 chip should use this link. Scroll down and click 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):
epicodus
. You can use your own password if you want but epicodus
will be assumed in the lessons.Next, configure your shell environment variables to know where to locate the MySQL Community Server. Open the command line and enter the following command:
For bash users:
$ echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.bash_profile
For zsh users:
$ echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.zshrc
Restart your shell (GitBash or Terminal) to apply the changes you've made to your shell's environment variables. Alternatively, you can refresh your shell by typing in the following command:
For bash:
$ source ~/.bash_profile
For zsh:
bash
$ source ~/.zshrc
Next, verify MySQL installation by opening terminal and entering this command:
$ mysql -uroot -pepicodus
You'll know it's working and connected if you gain access and see the MySQL command line. There will be an intro message, and the command prompt should look like this:
mysql>
If it's not working, you'll likely get a 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:
Students with High Sierra or Mojave should use this link. Scroll down and click the No thanks, just start my download link.
Students with Catalina will need to do a few more steps, since there is no readily available download page for the Workbench version we need. Follow these steps:
Students with Big Sur, Monterey, or a newer OS should use this link. Scroll down and click the No thanks, just start my download link.
Next, install MySQL Workbench to Applications folder. Open MySQL Workbench from within the Applications folder.
Once opened, 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!
These instructions are for Windows 10 and 11.
Start by downloading the MySQL Web Installer from the MySQL Downloads page. This will allow you to install both the MySQL Community Server and the MySQL Workbench.
Follow along with the installer:
epicodus
. You can use your own if you want but epicodus
will be assumed in the lessons.Next we need to make our GitBash shell recognize the command mysql
(more on this below) to open and run the MySQL console. We'll do this by configuring our system environment variables for "Path" so that the mysql
command can be recognized in any shell (including PowerShell as well as GitBash).
To do this, we must include MySQL in the System Environment "Path" Variable. This is its own multi-step process. The image below shows the buttons we click starting at step #2 below. If you find the image is hard to read, open it in a new tab.
C:\Program Files\MySQL\MySQL Server 8.0\bin
, but may differ depending on your specific installation.Next, verify the MySQL Community Server installation by opening Windows PowerShell and entering this command:
$ mysql -uroot -pepicodus
You'll know it's working and connected if you gain access and see the MySQL command line. There will be an intro message, and the command prompt should look like this:
mysql>
You can exit the mysql program by entering exit
.
Finally, 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.