Install Mysql Mac Catalina

How to Install MySQL 8.0 and Get Started with SQL Programming. I want you to install MySQL on your own machine, because I want you to learn how to install, customize and operate complex industrial software system. Installation could be the hardest part in this exercise. Step 0: Create a directory to keep all your works.

  • For example, if your Mac came with macOS Big Sur, it will not accept installation of macOS Catalina or earlier. If a macOS can't be used on your Mac, the App Store or installer will let you know. For example, it might say that it's not compatible with this device or is too old to be opened on this version of macOS.
  • As you might know, the MySQL Community Edition is available for macOS. Usually, I install MySQL server on Linux server but this time, I want to try it on my Hackintosh macOS Catalina. Steps to Install MySQL Server on macOS Catalina Step 1. Download the MySQL Server installation package. Navigate to the following link to download your copy of.
  • Homebrew’s package index. Also known as: mysql-client@8.0 Formerly known as: mysql-connector-c Open source relational database management system.

Recommend switching to Docker

I finally switched to using Docker for local development on macOS. While the following tutorial works for macOS Catalina, it has limitations. I recommend following my latest tutorial on installing Apache, MySQL, and PHP on macOS using Docker.

Note: This post assumes you followed installing Apache, PHP, and MySQL on Mac OS X Mojave and have since upgraded to macOS Catalina. If you did not follow the original post, you should follow installing Apache, PHP, and MySQL on macOS Catalina.

When Mac OS X upgrades it overwrites previous configuration files. However, before doing so it will make backups. For Catalina the original versions may have a suffix of mojave or be copied to a backup folder on the Desktop. Most of the time, configuring your system after updating Mac OS X is simply a matter of comparing the new and old configurations.

This post will look at the differences in Apache, PHP, and MySQL between Mac OS X Mojave and macOS Catalina.

Updating Apache

Mac OS X Mojave and macOS Catalina both come with Apache pre-installed. As noted above, your Apache configuration file is overwritten me when you upgrade to macOS Catalina.

There were a few differences in the configuration files. However, since both Mojave and Catalina run Apache 2.4, you could simply backup the configuration file from Catalina and overwrite it with your Mojave version.

However, I encourage you to stay up-to-date. As such, you should take the time to update Catalina's Apache configuration. First, create a backup and compare the two configuration files for differences.

Now edit the Apache configuration. Feel free to use a different editor if you are not familiar with vi.

Uncomment the following line (remove #):

In addition, uncomment or add any lines you noticed from the diff above that may be needed. For example, I uncommented the following lines:

Finally, I cleaned up some of the backups that were created during the macOS Catalina upgrade. This will help avoid confusion in the future.

Note: These files were not changed between versions. However, if you changed them, you should compare the files before running the commands.

Restart Apache:

Updating PHP

Mac OS X Mojave came with PHP version 7.1 pre-installed. This PHP version has reached its end of life. macOS Catalina comes with PHP 7.3 pre-installed. If you added any extensions to PHP you will need to recompile them.

Also, if you changed the core PHP INI file it will have been overwritten when upgrading to macOS Catalina. You can compare the two files by running the following command:

Note: Your original file may note be named something else. You can see which PHP core files exist by running ls /etc/php.ini*.

I would encourage you not to change the PHP INI file directly. Instead, you should overwrite PHP configurations in a custom PHP INI file. This will prevent Mac OS X upgrades from overwriting your PHP configuration in the future. To determine the right path to add your custom PHP INI, run the following command:

Note: It appears Catalina does not include the PHP Zip extension. This is a popular extension used by many packages. This was one of the reasons I switched to using Docker.

Updating MySQL

MySQL is not pre-installed with Mac OS X. It is something you downloaded when following the original post. As such, the macOS Catalina upgrade should not have changed your MySQL configuration.

Mysql

Find this interesting? Let's continue the conversation on Twitter.

If you want to run a server on your macOS Catalina, or you recently updated to Catalina, you might need to re-configure your system, follow the below instructions.

Updates

For macOS Big Sur (11.0.x) setup guide, please check out Setting Up Your Local Web Server on macOS Big Sur 11.0.1 (2020)| MAMP | macOS, Apache, MySQL, PHP

Start the Apache Server

You can start off the built-in Apache server by following the below steps.

Open Terminal from your Application folder or type “Terminal” in the Spotlight Search.

Type sudo apachectl start and press enter.

Open any of your favorite browser.

Type localhost or 127.0.0.1 in the address bar
If Apache server is started, you should see the below:

Create Sites directory

Let’s create a Sites directory under username folder (username is your mac login name) This directory is going to be the document root.

1. Go to Mac HDD > Users > [your account folder]

2. Create folder with the name Sites. When the folder is created, it will generate a folder with compass image on the folder.

Create username.conf file

To be able to recognize the files putting into Sites directory, username.conf needed to be setup. This is going to be your document root.

Type whoami and press enter. Note down the name. (that is your account name / username)

Create a username.conf file based on the account name showed up when you type whoami. e.g. If your username is developer the filename will be developer.conf.

Type cd /etc/apache2/users and press enter.

Type ls and press enter. Check if there is existing username.conf (username is your account name)

If there is an existing username.conf, make a backup copy by typing sudo cp username.conf username.conf.bakup.

Type sudo nano username.conf and press enter. Note: “username” will be your account name. e.g. developer.conf.

Copy and paste the following configuration.

Press Control+o and press enter to save the file.

Press Control+x to exit the nano editor

Configure the httpd.conf file

Open Terminal from your Application folder or type “Terminal” in the Spotlight Search.

Type cd /etc/apache2 and press enter.

Type sudo cp httpd.conf httpd.conf.bak and press enter. (This step is optional if you want to keep the copy of original config file)

Catalina

Type sudo nano /etc/apache2/httpd.conf and press enter.
(httpd.conf file will be opened in terminal’s editor. – in this case nano editor)

Press Control+w and type LoadModule authz_core_module and press enter. Uncomment the following modules. # means it is commented out. Remove the # in front of each module. If you cannot find the module, use the Control+w and type in the module name you are searching for.

Uncomment the following line for the User home directories.

Replace the below two lines with your username document root. (You can comment those two lines by putting # in front of them.

Replace with the following:

Note: USERNAME needs be replaced with your username (e.g. developer)

Press Control+w and type AllowOverride None.

Replace AllowOverride None to AllowOverride All

Your DocumentRoot configuration in httpd.conf will look like below:

Press Control+o and press enter to save the file.

Press Control+x to exit the nano editor.

Configure the httpd-userdir.conf file

Type cd /etc/apache2/extra and press enter.

Type sudo cp httpd-userdir.conf httpd-userdir.conf.bakup and press enter. (This step is optional if you want to keep the copy of original config file)

Type sudo nano httpd-userdir.conf and press enter.

Uncomment the following line.

Press Control+o and press enter to save the file.

Mac

Press Control+x to exit the nano editor.

Type sudo apachectl restart. To take effect all the changes made in the Apache config file.

Enable the PHP

Mac has built-in PHP. You just need to enable the PHP from the Apache’s config file. Follow the below steps.

1. Open Terminal from your Application folder or type “Terminal” in the Spotlight Search.

2. Type cd /etc/apache2 and press enter.

3. Type sudo nano /etc/apache2/httpd.conf and press enter.
(httpd.conf file will be opened in terminal’s editor. – in this case nano editor)

4. Press Control+w to bring up a search option.

5. Search for php and press enter.
You will see the following:

# means, the line is commented out.

6. Remove the # in front of LoadModule php7_module libexec/apache2/libphp7.so

7. Press Control+o and press enter to save the file.

8. Press Control+x to exit the nano editor

9. Type sudo apachectl restart. To take effect all the changes made in the Apache config file.

Create a phpinfo() page

To try out PHP is working on your system, create a phpinfo() file and load it on the browser.

Install Apache Php Mysql Mac Catalina

Open Terminal from your Application folder or type “Terminal” in the Spotlight Search.

Type cd ~/Sites/ and press enter.

Type sudo nano phpinfo.php and press enter. To create a phpinfo.php file. And it will bring you to nano editor within Terminal.

Put the following code:

Press Control+o and press enter to save the file.

Press Control+x to exit the nano editor.

Go to browser and type the following in the address bar.

You should see a page below if the PHP module is successfully activated.

Setting up the MySQL Server

Go to https://dev.mysql.com/downloads/mysql/

Download the DMG installer.

Double click the installer and follow the installation steps in the wizard.

Once the installation is complete, you should have the MySQL icon in the System Preferences.

Brew Install Mysql Mac Catalina

You can stop and start the MySQL server.

References

Thank you to following articles. I used the below articles as a reference.

Install Mysql Workbench Mac Catalina

Latest Posts