On macOS, you can install MySQL easily using Homebrew.
Download MySQL Server for Mac from the MySQL Community site. Mount the DMG and double click the.pkg file to begin the installation. Mount the DMG and double click the package to begin the installation. Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process. At this time of writing, Homebrew has MySQL version 8 as default, but as we're aiming to get 5.7, we'll need to append @5.7 to the default package key: Enter the following command: $ brew info [email protected]
The above command should take a while, then print something like this:
You can now start the MySQL server by running:
The world's most popular open source database MySQL.com; Downloads; Documentation; Developer Zone; Developer Zone Documentation MySQL.com. I'm trying to install mysql on MAC OS version 10.11.2 by following the methods in this link, The following command has been successfully executed, brew install mysql but when I type the following.
Now we need to secure the MySQL server. By default the server comes without a root password, so we need to make sure it’s protected.
The procedure can take a while, but it gives a lot of power to make sure you get the best defaults out of the box:
Since we used
brew services start mysql to start MySQL, your Mac will re-start it at reboot. You can run:
to stop this from happening, and also to immediately stop MySQL.
You can also avoid this daemon mode (that’s what we call programs that always run in the background and restart when the computer is restarted) by running:
This will start MySQL and will keep it running until the computer is shut down, or until you run:
Download Mysql For Mac Using Brew
and it will not re-start it at reboot.
It’s up to you to decide which one you prefer.
Now you can connect to the server using the command:
You will need to type the
root user password after you run this command, and once you are done you should see this screen:
A great GUI (graphical) software we can use to interact with a SQLite database is TablePlus.
It comes with a free trial that’s perfect for our usage, because it’s not time-based but rather it limits the amount of concurrent connections you can make to the database.
Install Homebrew In Mac
Download it from https://tableplus.com. I know there are macOS, Windows and Linux versions.
Click “Create a new connection…” and select MySQL in the list:
then set a name for the connection, and enter “root” and the password you set previously:
Homebrew On Mac
Connect, and you should be connected to MySQL!
Note that we are connected using the
root user, which should only be used for administration purposes.
Day to day use of a database should be done using a normal user. We’ll see it in a separate tutorial.
Coming soon:Huge Black Friday sale for all my courses
MariaDB Server is available for installation on macOS (formerly Mac OS X) via the Homebrew package manager.
MariaDB Server is available as a Homebrew 'bottle', a pre-compiled package. This means you can install it without having to build from source yourself. This saves time.
After installing Homebrew, MariaDB Server can be installed with this command:
After installation, start MariaDB Server:
To auto-start MariaDB Server, use Homebrew's services functionality, which configures auto-start with the launchctl utility from launchd:
After MariaDB Server is started, you can log in as your user:
Or log in as root:
First you may need to update your brew installation:
Then, to upgrade MariaDB Server:
Building MariaDB Server from source
In addition to the 'bottled' MariaDB Server package available from Homebrew, you can use Homebrew to build MariaDB from source. This is useful if you want to use a different version of the server or enable some different capabilities that are not included in the bottle package.
Two components not included in the bottle package (as of MariaDB Server 10.1.19) are the CONNECT and OQGRAPH engines, because they have non-standard dependencies. To build MariaDB Server with these engines, you must first install
judy. As of December 2016, judy is in the Homebrew 'boneyard', but the old formula still works on macOS Sierra. Follow these steps to install the dependencies and build the server:
You can also use Homebrew to build and install a pre-release version of MariaDB Server (for example MariaDB Server 10.2, when the highest GA version is MariaDB Server 10.1). Use this command to build and install a 'development' version of MariaDB Server:
- Terin Stock (terinjokes) who is the packager for Homebrew