Welcome back to another SecuringNinja tutorial. No cyber security researcher should be with out a database to practice their skills on, or just to store tons of relational data. Today we will show you how to install MySQL on a Mac. Having a local database is perfect for running websites locally, or for providing persistent storage for another application.

In this article we cover how to:

Brew install mysql. Once the installation completes, we’ll want to take care of a few more things. First, let’s tell it to start automatically whenever we reboot the system: brew services start mysql. By default, MySQL is installed without a root password. This is considered insecure, so let’s get one set: mysqlsecureinstallation. MinIO Client Quickstart Guide. MinIO Client (mc) provides a modern alternative to UNIX commands like ls, cat, cp, mirror, diff, find etc. It supports filesystems and Amazon S3 compatible cloud storage service (AWS Signature v2 and v4). Aug 19, 2020 brew install [email protected] Using MySQL. With MySQL now installed on your system, to get up and going as quickly as possible writing SQL queries, it’s recommended that you use an SQL management application to make managing your databases a much simpler, easier process. Install brew services first: $ brew tap homebrew/services. Load and start the MySQL service: $ brew services start [email protected] Expected output: Successfully started mysql (label: homebrew.mxcl.mysql) Check of the MySQL service has been loaded: $ brew services list 1. Force link 5.7 version - $ brew link [email protected] -force.

MySQL is very straight forward to install on a Mac. If you do not already have the Homebrew package manager for Mac you’ll need to install that first. If you would rather not install Homebrew you can also install MySQL using the DMG file available on the MySQL site.

Installing Homebrew on Mac

Lets start by opening up Terminal and installing Homebrew. Homebrew is a macOS package manager that makes installing packages on macOS a breeze.

To install Homebrew on Mac run the following command:

Once the install is complete go ahead and run an update to test that everything is working correctly.

With Homebrew installed it is a simple matter to install MySQL.

Installing MySQL on Mac with Brew

Installing MySQL with Brew is a breeze. All it takes is:

This will install the most recent version of the package available on Brew. As of this writing it is MySQL version 8.0. To install a different version simply append the version to the end of the package with an @ symbol. For example, to install MySQL 5.7 use:

If you don’t want to install Homebrew you can also install MySQL with the DMG file available for download as described below.

Installing MySQL with a DMG file

You can also install MySQL via the DMG file on the MySQL downloads page. This will add a MySQL preference pane in System Preferences as well. You can start and stop your server from here too.

First begin by downloading and mounting the DMG file available from the MySQL Community downloads page. Make sure you grab the appropriate DMG for your OS version.

Mount the DMG and double click the .pkg file to begin the installation.

Step through the installer installer and make a note of your temporary root password. You will need this for the initial connection to the server. DO NOT LOSE IT!

The server will require that you update your password on the first login. MySQL server is now installed. To start the server use launchctl or the MySQL preference pane in System Preferences. The server uses very few resources while running in the background so there really is no need to start and stop the server each time.

To start the server via launchctl:

This instructs MySQL to start when the system boots up.

You can also start and stop MySQL through the System Preferences pane. Open System Preferences and select MySQL:

And finally, start or stop the server as needed.

From this preference pane you can also edit the MySQL server configuration, re-initialize the database, and uninstall MySQL server entirely. We cover how to uninstall MySQL on Mac in the next section.

Uninstalling MySQL on Mac

If you installed MySQL via the DMG file method then uninstalling is extremely straight forward. Navigate to the MySQL preference pane in System Preferences, and click Uninstall. Thats it! MySQL has been uninstalled.

If you however installed MySQL using the Brew method described above, then there are a couple of extra steps.

Uninstalling MySQL on Mac with Brew

The steps below show how to uninstall MySQL installed with Brew. Begin by finding any running MySQL processes and stopping them. Then uninstall MySQL and remove all files.

What to do with your new database

Now that you’ve got a local database up and running you may want to take a look at how a SQL injection attack works. Your new database will be great for practice! If you have any issues getting your database up and running, please reach out in the comments below. We would love to assist you!

In this tutorial we will learn to install PostgreSQL database on Mac using Homebrew.

Brew Mysql Start


It is assumed that you have Homebrew installed on your Mac.

If you don't have Homebrew installed on your Mac then open Terminal and run the following command.

You can visit Homebrew official website https://brew.sh to learn more about it.

Once you have Homebrew (a.k.a. brew) installed on your machine you can run the following command in the Terminal to check the version.

Brew services start mysql not working

To update run the following command.

Brew Mysql Start

Alright, time to install PostgreSQL on Mac.

Install PostgreSQL using Homebrew

In Terminal run the following command to install PostgreSQL on Mac using Homebrew.

We can check the version of PostgreSQL using the psql command.

Start PostgreSQL

To start PostgreSQL run the following command in the Terminal.

We will get a similar output shown below.

Stop PostgreSQL

To stop PostgreSQL run the following command in the Terminal.

We will get a similar output.

Restart PostgreSQL

To restart PostgreSQL run the following command in the Terminal.

We will get a similar output as shown below.

Login to PostgreSQL database

By default we will get a database by the name postgres. So, to connect to it we will run the following command.

We will see the following output.

List all the users

To list all the users we use the du command.

List all the databases

To list all the databases run the l command.

Create a database

To create a database run the following command. In the given example mydb is the name of the database.

Connect to a database

To connect to a database use the c command.

List all the tables inside a database

To list all the tables inside a database we run the d command.

Note! If there is no table then we will get a prompt stating no relations found.

Let us go ahead and create a simple users table inside the mydb database and try the above command again.

Create table

Brew Mysql Not Starting

Brew Mysql StartBrew services start mysql not working

In the following example we are creating a simple users table.

Now if we list the tables using the d command we will get the table.

How to exit from psql?

Brew Mysql Start Up Tool

To exit or quit from psql type the q command.

Brew Mysql Won't Start

Alright, this brings us to the end of this tutorial. Hope you found it useful. Please share this tutorial if it was helpful. See you in the next tutorial. Have fun developing :-)