Install Mysql On Mac Catalina

Install MySQL on macOS Catalina. Download and install the latest MySQL generally available release DMG for macOS. MySQL 8 is the latest version. But older versions are available if you need to support older applications. When the install completes it will provide you with a temporary password. Copy this password before closing the installer. Hello Friends,In this video tutorial, you will learn to install mysql database server on mac os x catalina. I have explained the whole process of installatio.

Mac Os Catalina Mysql Posted on by admin The professional data recovery software for Mac can recover deleted files even if they have been permanently removed or emptied from Trash or Bin. Part 2: macOS 11.0 Big Sur Web Development Environment. In Part 1 of this 3-part series, we covered configuring Apache on macOS to work better with your local user account, as well as the installation process for installing multiple versions of PHP. In this Part 2, we will cover installing MySQL, Virtual Hosts, APC caching, YAML, and Xdebug.

Second part in a multi-part blog series for Mac developers

Part 2: macOS 11.0 Big Sur Web Development Environment

In Part 1 of this 3-part series, we covered configuring Apache on macOS to work better with your local user account, as well as the installation process for installing multiple versions of PHP.

In this Part 2, we will cover installing MySQL, Virtual Hosts, APC caching, YAML, and Xdebug. After finishing this tutorial, be sure to check out how to enable SSL in Part 3 of the series.

11/13/2020 Updated to reflect the release of macOS 11.0 Big Sur
12/02/2019 Updated to reflect the latest release of PHP 7.4 and the removal of PHP 7.1 from Official tap
12/02/2019 Updated to reflect the latest release of PHP 7.4 and the removal of PHP 7.1 from Official tap
10/08/2019 Updated to reflect the release of macOS 10.5 Catalina
01/10/2019 Updated to add back PHP 5.6 and PHP 7.0 from and external deprecated keg
12/12/2018 Updated to reflect the latest release of PHP 7.3 and the removal of PHP 7.0 from Brew.

This guide is intended for experienced web developers. If you are a beginner developer, you will be better served using MAMP or MAMP Pro.

Although not required for development of Grav, there are times you definitely need an installation of MySQL. In the original guide, we used the Oracle MySQL installation package. However, we now have switched to MariaDB which is a drop-in replacement for MySQL and is easily installed and updated with Brew. Detailed information on the HomeBrew installation process can be found on the mariadb.org site but the essentials are as follows:

Install MariaDB with Brew:

After a successful installation, you can start the server ane ensure it autostarts in the future with:

You should get some positive feedback on that action:

You must change MySQL server password and secure your installation. The simplest way to do this is to use the provided script:

Just answer the questions and fill them in as is appropriate for your environment. You can just press return when prompted for the current root password.

Download TablePlus and install it. (it's awesome and there's a free version!). You should be create a new MySQL connection, give it a Name, a color, and check Use socket option after you enter a User of root and your newly created password.

If you need to stop the server, you can use the simple command:

A very handy development option is to have multiple virtual hosts set up for you various projects. This means that you can set up names such as grav.mydomain.com which point to your Grav setup, or project-x.mydomain.com for a project-specific URL.

Apache generally performs name-based matching, so you don't need to configure multiple IP addresses. Detailed information can be found on the apache.org site.

Apache already comes preconfigured to support this behavior but it is not enabled. First you will need to uncomment the following lines in your /usr/local/etc/httpd/httpd.conf file:

and:

Then you can edit this referenced file and configure it to your needs:

This file has some instructions already but the important thing to remember is that these rules are matched in order. When you set up virtual hosts, you will lose your older document root, so you will need to add back support for that first as a virtual host.

Don't forget to change your_user for your actual username on your Mac. For example: DocumentRoot '/Users/bernard/Sites'

As you set up your .test virtual hosts, you may receive a warning such as Warning: DocumentRoot [/Users/your_user/Sites/grav-admin] does not exist when restarting Apache. This just lets you know that the source directory listed for your virtual hosts is not present on the drive. It's an issue that can be resolved by editing this file with the corrected DocumentRoot.

We used to recommend using .dev domain name, but since Chrome 63 forces all .dev domains to use SSL, this guide has been updated to use .test

In the example virtualhost we setup above, we defined a ServerName of grav-admin.test. This by default will not resolve to your local machine, but it's often very useful to be able to setup various virtual hosts for development purposes. You can do this by manually adding entries to /etc/hosts ever time, or you can install and configure Dnsmasq to automatically handle wildcard *.test names and forward all of them to localhost (127.0.0.1).

First we install it with brew:

Then we setup *.test hosts:

Start it and ensure it auto-starts on reboot in the future:

And lastly, add it to the resolvers:

Catalina

Now you can test it out by pinging some bogus .test name:

Catalina

Voila! we have successfully setup wildcard forwarding of all *.test DNS names to localhost.

Caching in PHP is a big part of the performance equation. There are two types of caching typically available, and both have a big impact on speed and performance.

The first type of cache is called an opcode cache, and this is what takes your PHP script and compiles it for faster execution. This alone can typically result in a 3X speed increase!.

The second type of cache is a user cache, and this is a entry that PECL adds to the top of your php.ini. So edit this file and remove the top line:

Once that line is removed, we can add a new file with a proper entry to the recently bulit apcu.so library:

In this file paste the following:

Restart Apache with the brew services stop httpd; brew services start httpd command to pick up your changes.

APCu for other PHP versions

For PHP 7.0 and above you can use the latest 5.x release of APCu, so the process is the same for all. First let's switch to PHP 7.0 and install the APCu library:

Restart Apache with the brew services stop httpd; brew services start httpd command to pick up your changes.

The uninstall -r enables PECL to only remove registration, it does not actually uninstall anything.

Again if you are OK with the ACPu defaults, you can leave things as-is, but you can choose to repeat the Optional APCu Configuration steps to create an APCu configuration file fore each PHP version.

For PHP 7.1, just repeat these steps but use 7.1 instead of 7.0:

For PHP 7.2:

For PHP 7.3:

For PHP 7.4:

With recent versions of Grav, we now make use of the native PECL YAML library that allow YAML processing to be done by highly efficient libYAML C library rather than by they Symfony PHP library. This can result in a 5X improvement in YAML processing times! Luckily this is a simple process to install for any PHP version:

Switch to PHP 5.6 mode, then run the following brew commands to install libyaml:

Then you can install YAML via PECL.

For PHP 5.6 we have to install the latest 1.3.x version of YAML, as this is the last version to provide PHP 5.6 support:

Answer any question by simply pressing Return to accept the default values

Restart Apache with the brew services stop httpd; brew services start httpd command to pick up your changes.

YAML for other PHP versions

For PHP 7.0 and above you can use the latest 2.x release of YAML, so the process is the same for all. First let's switch to PHP 7.0 and install the YAML library:

Restart Apache with the brew services stop httpd; brew services start httpd command to pick up your changes.

The uninstall -r enables PECL to only remove registration, it does not actually uninstall anything.

For PHP 7.1, just repeat these steps but use 7.1 instead of 7.0:

and for PHP 7.2:

and for PHP 7.3:

and again for PHP 7.4:

[Optional] YAML Configuration

Can i install mysql on mac

If you are feeling adventurous, or you like to keep things uniform, you can follow the same procedure as APCu and remove the default extension-'yaml.so' entry in each PHP's php.ini and instead, create a conf.d/ext-yaml.ini file:

One of the most important aspects of any kind of development is the ability to debug and fix your code. PHP comes with limited support to dump variables or log to a file, but for more complex situations you need something more powerful.

Xdebug provides is a debugging and profiling extension for PHP that provides an HTML-friendly output for the var_dump() method that improves the readability of the default version. It also provides other useful dumping methods as well as displaying stack traces. One of the best features however, is the ability to remote debug your code. This means you can set breakpoints, and step through your PHP code inspecting as you go. Full documentation on Xdebug contains extensive information about all the functionality available.

Xdebug for various PHP versions

There are some compatibility issues we need to take into account, as certain versions of PHP can only run certain versions of Xdebug:

PHP VersionCompatible Xdebug version
PHP 5.6Xdebug 2.5
PHP 7.0Xdebug 2.7
PHP 7.1Xdebug 2.9
PHP 7.2+Xdebug 3.0

To install specific versions of Xdebug we need to switch to the PHP version we want to install it on, then run these commands:

For PHP 5.6
For PHP 7.0
For PHP 7.1
Apache
For PHP 7.2+

change sphp 7.2 to the version you want to install xdebug for (from 7.2 to 8.0)

Xdebug Configuration

Like the other PECL-installed modules, this will create a simple entry in the php.ini file, but you really need to configure Xdebug for it to be useful. So let's just go ahead and create our configuration file as we'll need it shortly anyway.

You will now need to remove the zend_extension='xdebug.so' entry that PECL adds to the top of your php.ini. So edit this file and remove the top line. In this example we will use 5.6 but it's the same procedure for each version of PHP.

Once that line is removed, we can add a new file with a proper entry to the recently bulit xdebug.so library:

For Xdebug versions prior to 3.0 (ie, PHP 5.6 through PHP 7.1) you can paste the following into the file:

However, Xdebug version 3.0 (ie, PHP 7.2+) has a simplified syntax and should look like this:

Restart Apache with the brew services stop httpd; brew services start httpd command to pick up your changes. You should check the http://localhost/info.php to ensure that Xdebug information is displayed:

if Xdebug still shows up in php -v the most likely cause is you didn't remove the zend_extension='xdebug.so' entry at the top of php.ini

Restart Apache with the brew services stop httpd; brew services start httpd command to pick up your changes.

Xdebug Switcher Script

W00fz created a great tool for quickly enabling/disabling xdebug. Install this with brew:

Using it is simple, you can get the current state with:

And then turn it on or off with:

CLI Enabled Xdebug

There are times when you want to debug from the CLI, and you can do this by setting an environment variable. My preferred approach is to use a simple script that works with all versions of Xdebug. First create a file in your user's bin/ folder (create the folder if it doesn't already exist), and call it xdebug.conf then save this:

Can I Install Mysql On Mac

Then ensure it's executable:

Then when you need to debug, simply run it whenever you need it:

You should now be all set with a Rockin' PHP development environment! To find out how to enable SSL on Apache, check out Part 3 in the series.

NOTE: The brew installation actually creates configuration files in /usr/local/etc/php/5.6/conf.d, /usr/local/etc/php/7.0/conf.d, /usr/local/etc/php/7.1/conf.d, /usr/local/etc/php/7.2/conf.d, /usr/local/etc/php/7.3/conf.d, and /usr/local/etc/php/7.4/conf.d respectively. If you want to uninstall a PHP extension, simply rename the .ini file to .ini.bak and restart apache. Alternatively, you can simply use brew to uninstall it, and reinstall it again when you need it.

Please enable JavaScript to view the comments powered by Disqus.

Getting Started with 'Terminal' - MUST READ Before You Start Programming

Programmers use 'Terminal' to issue commands, instead of the graphical user interface - which is meant for common users.

You MUST have some basic knowledge on using the Terminal and the file system. Read 'Unix Survival Guide for Mac & Ubuntu - Terminal, File System and Users'.

How to Install JDK and Get Started with Java Programming on Mac

Read HERE.

Programming Text Editors for Mac

TextEdit for Mac

TextEdit (the default text editor in Mac OS X) is NOT a programming text editor, as it lacks features like syntax highlighting. I strongly suggest you install a programming text editor.

To use TextEdit to write source file, you need to open a new file ⇒ choose 'Format' ⇒ 'Make Plain Text'.

You can open an existing file in TextEdit from Terminal by issuing:

nano (or pico) Command-line Text Editor

nano is a GNU text editor that is available for Unix Systems (including Mac OS X), that is suitable for creating/editing small files. To start nano, open a Terminal and issue:

You can run nano with superuser (for accessing restricted directories), as follows:

JEdit for Mac

jEdit is a popular open-source cross-platform (Mac, Windows, Linux) programming text editor. The mother site is http://www.jedit.org.

Step 1: Download and Install jEdit for Mac
  1. Download jEdit package from http://www.jedit.org ⇒ Download ⇒ Select Mac OS X package (stable version).
  2. Double click the downloaded Disk Image ('.dmg') file. Drag the 'jEdit' icon to 'Applications' folder.
  3. Eject the Disk Image 'jedit.dmg'.
Step 2: Install 'Console' plugins
  1. Launch jEdit (from 'Applications').
  2. Open plugin manager: From 'Plugins' menu ⇒ Plugin Manager.
  3. Select 'Install' tab.
  4. Search and select 'Console' plugin. 'ErrorList' plugin will selected automatically ⇒ Install.
Step 3: Write a Hello-World Java Program
  1. Open a new file by selecting 'File' menu ⇒ 'New'.
  2. Enter the following Java source code and save the file as 'Hello.java'.
Step 4: Compile and Run the Hello-World Java Program

You can start a 'Terminal' to compile and run your Java program as described in the above JDK section.

You can also use the 'Console' plugin:

  1. To compile: From Plugins ⇒ Console ⇒ Compile Current Buffer. Click on the 'Console' button to view the console. If message 'Process javac exited with code 0' appears, the program is compiled successfully.
  2. To run: From Plugins ⇒ Console ⇒ Run Current Buffer.

Install Mysql On Mac Catalina Operating System

gedit for Mac

gedit is the official text editor of the GNOME desktop environment. The mother site for gedit is http://projects.gnome.org/gedit/.

  1. Download gedit for Mac (DMG version) from http://projects.gnome.org/gedit/ ⇒ 'gedit mac os x' ⇒ Choose your specific Mac OS version.
  2. To install:
    1. Double-click the downloaded Disk Image ('.dmg') file.
    2. Drag the 'gedit' icon to the 'Applications' folder.
    3. Eject the Disk Image 'gedit.dmg'.

Notes: To use 'gedit' commands in Terminal, you need to add '/Applications/gedit.app/Contents/MacOS/' to PATH environment variable.

Sublime

@ http://www.sublimetext.com.

How to Install Eclipse on Mac

Read 'How to Install Eclipse for Mac OS'.

How to Install NetBeans on Mac

Read 'How to Install NetBeans on Mac'.

How to Install MySQL 5.6 on Mac OS X 10.7 Lion

Install MySQL using the DMG Package

Reference: 'Installing MySQL on Mac OS X' @ http://dev.mysql.com/doc/refman/5.6/en/macosx-installation.html.

Step 1: Download and Install MySQL

Download the MySQL 'DMG Archive':

  1. Go to http://dev.mysql.com/downloads/mysql/. In platform, select the 'Mac OS X'.
  2. Select the appropriate 'DMG Archive' for your specific Mac OS version:
    • Click the Apple logo ⇒ 'About this Mac' to check your Mac OS version.
    • Read http://support.apple.com/kb/ht3696 to check if your OS is 32-bit or 64-bit.
    For example, Choose 'Mac OS X ver. 10.7 (x86, 64-bit), DMG Archive (117.5M)' for Lion and Core i7 processor.
  3. Click 'No thanks, just start my download'.

To install MySQL:

  1. Go to 'Downloads' ⇒ Double-click '.dmg' file downloaded.
  2. Double-click 'mysql-5.5.{xx}-osx10.x-xxx.pkg' ⇒ Follow the instructions to install MySQL. Click continue if 'unindentified developer' warning dialog appeared.
  3. MySQL will be installed in '/usr/local/mysql-5.5.{xx}-osx10.x-x86_xx' directory. A symbolic link '/usr/local/mysql' will be created automatically to the MySQL installed directory.
  4. Eject the '.dmg' file.
Step 2: Configuring MySQL - Change TCP Port Number for MySQL Server
  1. The default TCP port number used by MySQL Server is 3306.
  2. [For novices: SKIP THIS STEP to run the MySQL Server on port 3306. Goto Step 3.]
    You can change the port number by editing the configuration file 'my.cnf' at directory '/usr/local/mysql'. To create this file, open a new 'Terminal' and run the 'nano' editor using this command: Modify the lines in green and add in the lines in red; and press ctrl-X to exit. (We use the 'nano' editor in this case, you can use any text editor, but run in superuser.)

Notes: On Unix/Mac, the MySQL read the options file in this order: '/etc/my.cnf', 'SYSCONFDIR/mf.cnf', '$MYSQL_HOME/my.cnf', '~/.my.cnf'.

Step 3: Start/Shutdown the MySQL Server

Easeus data recovery mac review. Open a new 'Terminal' and issue these commands to start the MySQL server:

To shutdown the server, start a new terminal and issue:

Step 4: Start/Stop a MySQL Client

Open a new 'Terminal' and issue this command to start a MySQL client with superuser root:

To terminate the client, issue command 'exit' (or 'quit') from the 'mysql>' prompt:

Notes:
  1. You can use 'Activity Monitor' (under Applications/Utilities) to check if the MySQL Server is running. Look for process starting with mysqld.
  2. The log messages are written to /usr/local/mysql/data/xxx.err, where xxx denotes your machine name. Issue 'sudo cat /usr/local/mysql/data/xxx.err' to view the messages.
  3. If you get the following error message when starting a client: 'Can't connect to local MySQL server through socket '..', check your 'Activity Monitor' to see if the MySQL server has been started.
Step 5: (For Java Programmers) Install MySQL JDBC Driver
Mysql
  1. Download the latest JDBC driver from http://www.mysql.com/downloads ⇒ MySQL Connectors ⇒ Connector/J ⇒ Compressed TAR archive (e.g., mysql-connector-java-{5.x.xx}.tar.gz, where {5.x.xx} is the latest release number).
  2. Double-click on the downloaded TAR file to expand into folder 'mysql-connector-java-{5.x.xx}'.
  3. Open the expanded folder. Copy the JAR file 'mysql-connector-java-{5.x.xx}-bin.jar' to JDK's extension directory at '/Library/Java/Extension'.

How to Uninstall and Remove MySQL 5

  1. Open a Terminal ⇒ Run the 'nano' editor to edit /etc/hostconfig, as follows: Delete this line if present: 'MYSQLCOM=-YES-'. Press cntl-x to exit 'nano' and enter 'Y' to save the file. The line 'MYSQLCOM=-YES-' starts MySQL automatically during startup.
  2. Make sure that MySQL is not running (Open the 'Activity Monitor' under the 'Applications/Utilities', and check for the process 'mysqld'). Open a Terminal and issue 'rm -r' to remove these directories and their sub-directories (with 'f' indicating no confirmation prompt).

That's all!

(Advanced) Install MySQL using Tarball

Reference: http://dev.mysql.com/doc/refman/5.5/en/macosx-installation-pkg.html.

Install Mysql Workbench Mac Catalina

[TODO]

How to Install Tomcat 7 on Mac

Step 1: Download and Install Tomcat
  1. Goto http://tomcat.apache.org ⇒ Download ⇒ Tomcat 7.0 ⇒ 7.0.{xx} (where {xx} denotes the latest release) ⇒ Binary distribution ⇒ Core. Download the 'tar.gz' package (e.g., 'apache-tomcat-7.0.{xx}.tar.gz').
  2. To install Tomcat:
    1. Goto '~/Downloads', double-click the downloaded TAR file (e.g., 'apache-tomcat-7.0.{xx}.tar.gz') to expand it into a folder (e.g., 'apache-tomcat-7.0.{xx}').
      (Notes for Advanced Users) Alternatively, you can use the tar command to expand the tarball as follow:
    2. Move the extracted folder (e.g., 'apache-tomcat-7.0.{xx}') to '/Applications'.
    3. Rename the folder 'tomcat', for ease of use.

(Notes for Advanced Users):

  1. It is probably better to keep the tomcat in '/usr/local' or '/Library'.
  2. Instead of renaming the tomcat's folder, it it better to create a symlink called tomcat as follows:
  3. For security reason, you should not run Tomcat as root user. Instead, assign Tomat to user nobody (of group nobody):
Step 2: Configure Tomcat Server

Read 'Configure Tomcat Server'.

Step 3: Start the Tomcat Server

To start the Tomcat server, open a new 'Terminal' (Go ⇒ Utilities ⇒ Terminal) and issue:

Check for the Tomcat server's TCP port number from the console messages. The default is 8080.

Brew Install Mysql Mac Catalina

To verify if the Tomcat server is started, start a browser (Safari) and issue URL http://localhost:8080, suppose that Tomcat is running on the default TCP port number of 8080.

Also try URL http://localhost:8080/examples which shows the Servlet/JSP examples.

Step 4: Shutdown the Tomcat Server

To shutdown the Tomcat server, you can simply press control-c (NOT command-c) on the tomcat console, or issue command:

Step 5: Servlet API

To write Java servlets, you need to COPY the Servlet API JAR file ('servlet-api.jar') from '/Applications/tomcat/lib' to the JDK's extension directory at '/Library/Java/Extension'.

Install Mysql On Mac Catalina

Installing GCC and Get Started with C/C++ Programming on Mac

To install

  1. Goto http://connect.apple.com, and login with your AppleID.
  2. Download 'Command Line Tools (OS X xxxx) for XCode' Disk Image (DMG).
  3. Double-click the download disk image (DMG) ⇒ Open 'Command Line Tools (xxx).mkpg' ⇒ Follow the instructions to install.
  4. Eject the disk image.

To verify:

Installing XCode & Get Started

XCode is the development toolset for Mac, iPhone/iPad, which includes the Mac OS SDK (for Mac) and iOS SDK (for iPhone/iPad).

To install:

  1. Goto http://connect.apple.com, and login with your AppleID.
  2. Download 'XCode 4.x' Disk Image (DMG) - It is HUGE!
  3. Double-click the download disk image (DMG) ⇒ Open 'XCode' ⇒ Follow the instructions to install.
  4. XCode will be installed in '/Developer/Applications/Xcode'.
  5. Eject the disk image.

To start Xcode, launch 'XCode' from '/Developer/Applications'.

[TODO] Getting Started

More on Terminal & Bash Shell

Goto 'Terminal & Bash Shell'.

Mac's Tips & Tweaks

Root (or Superuser, or Administrator)

In some cases (such as installing software and starting server), you need to be the so-called root user (or superuser or administrator) of your machine to complete some commands that require high privilege. Put 'sudo' (superuser do) in front of your command to run the command as root user, and provide the your password. Only authorized user can issue sudo command. For example, to start the MySQL server:

How to View All Files in Finder

  1. Open a terminal and enter this commands:
  2. Stop the Finder via:
  3. Re-start the Finder. You shall see all the files (including the dot files and dot folders) now.

Miscellanous

  • The equivalent of Windows' 'Task Manager' in Mac is called 'Activity Monitor' under 'Applications/Utilities'.
  • The page-up, page-down, home and end keys are fn-up-arrow (or command-up-arrow), fn-down-arrow (or command-down-arrow), fn-left-arrow and fn-right-arrow, respectively.

Contributed by Wang Qiang (WANG0586@e.ntu.edu.sg).