The first step in setting up a MySQL database server on your Mac is to download the MySQL installer. MySQL offers a free edition called the MySQL Community Server. Click the link below to be taken to the download page for the MySQL Community Server. In the 'Select Operating System' box, select macOS.
MySQL Community Server Download
Click the Download button next to the first option, the DMG archive download. At the time of this writing, version 8 of the community server is the default download.
- Mysql Server Download Mac
- Mysql Server Download Mac M1
- Download Mysql Server 5.6 For Mac
- Download Mysql Server For Mac
Once the DMG file is downloaded, double-click the DMG file to open the disk image. Once the disk image is opened, a new Finder window will appear with a .pkg file named something like the following:
To install MySQL, do the following steps:
- 1. Double-click the .pkg file. This will launch the MySQL installer
- 2. Continue with the default options. At one point during the installation, the installer will ask whether to use strong password encryption or legacy password encryption. Some MySQL tools do not yet support strong password encryption. If the tools you are using to connect to MySQL do not support strong password encryption, select the legacy password encryption option. Note that RazorSQL supports strong password encryption.
- 3. Make sure to enter a password for the root MySQL user when prompted, and select the 'Start MySQL Server once the installation is complete' option as well.
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. 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. Start MySQL: sudo port load mysql5-server. Stop MySQL: sudo port unload mysql5-server. Mac OS X Server. Mac OS X Server comes with MySQL pre-installed. For instructions on how to enable MySQL, see Setup on Mac OS X Server. Installing MySQL on a Virtual Private Server (VPS) Slicehost Articles. Install MySQL on Ubuntu Hardy Install MySQL on CentOS.
When the installer completes your MySQL server will be installed and running on your Mac. Once you have gotten to this point, you have a running MySQL server with one user - the root user - and the default database named mysql. Now it is time to connect to your MySQL database, create a user, and create a database.
To get connected to your MySQL database, you can use a tool like RazorSQL. RazorSQL can be downloaded from the Download link on the header at the top of this page. Once RazorSQL is downloaded and installed, do the following to connect to your MySQL database:
- 1. Select the Connections -> Add Connection Profile menu option
- 2. Select MySQL as the database type and click 'Continue'
- 3. Enter any name you wish for the connection profile name and enter a name for the profile folder if desired
- 4. For the Login, enter root. For the password, enter the root password you gave to the MySQL installer
- 5. For the Host or IP Address, enter localhost
- 6. For the database name, enter mysql
- 7. Click Connect
At this point, you should be connected to your local MySQL database in RazorSQL.
After connecting, you can create a new database by doing the following:
- 1. Select the DB Tools - Create -> Create Database menu option
- 2. Enter a database name and then click 'Generate SQL'
- 3. Click the Execute SQL button to create the database.
If you would like to manually create the MySQL database, execute the following command. This creates a new database named sample with UTF8 support:
create database sample character set 'utf8mb4'
Below is a screen shot of the create database window.
After creating the sample database, we can then create a new user. This will allow us to connect to the MySQL database without using the root user.
To create a new user, select the DB Tools -> Create -> Create User menu option. If you installed MySQL version 8, make sure the 'Use MySQL 8 Syntax' box is selected.
If you want the user to be able to access your MySQL instance from other machines, make sure to check the 'All Domains' option, or else click the 'Select Domains' button to add specific ip addresses / hosts.
You will need to give the new user access to the sample database. To do this, either click the 'Select Databases' button and add the sample database, or click the 'All Databases' box to give the new user access to all databases.
Click the Generate SQL button to preview the commands for creating the user. Click the Execute SQL button to create the user. Below are example commands generated by the create user tool. These can be manually executed to create the user if not using RazorSQL or the create user tool:
CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'testpass';CREATE USER 'testuser'@'%' IDENTIFIED BY 'testpass';GRANT ALL PRIVILEGES ON *.* TO 'testuser'@'localhost';GRANT ALL PRIVILEGES ON *.* TO 'testuser'@'%';flush privileges;
Below is a screen shot of the RazorSQL MySQL Create User tool.
After creating the new user, you can set up a new RazorSQL connection to the database using the new user instead of the root user. Once you are connected with your new user, below are some sample commands to create a new table, insert data into the table, and query data in the table.
CREATE TABLE department ( dnumber INT NOT NULL, dname VARCHAR(25) NOT NULL, PRIMARY KEY (dnumber));insert into department values (1, 'Headquarters');insert into department values (4, 'Administration');insert into department values (5, 'Research');select * from department;
The above commands can be executed manually, or you can use the following tools in RazorSQL to create the table and insert the data using visual tools:
RazorSQL MySQL Create Table Tool
RazorSQL MySQL Table Editor
How to install MySQL server on Mac OS X
Mac OS X has a great design and a lot of tasks are really easy to do. Unfortunately if you want to have MySQL server installed on your Mac this is not always as simple as everything else.
But wait do I need MySQL server?
In many cases you do not. If this is going to be the only computer on which you will have your sales information, you are planning to have only a few operations every day, or you will connect to other computers using IncoCloud, then no, you can use SQLite and keep things simple.
But if you have more than one computer in the office/shop/restaurant connected together – one or more front office computers or tablets and one or more back office computers all in a single location, for example, or you expect many operations made every day, then you need MySQL server to handle the big load.
Important!IncoPOS – our Point of Sale system for macOS can now download, install and configure MySQL server for you. This happens from the built-in wizard when IncoPOS is started for the first time. You can download IncoPOS from here.The first step is to download MySQL server. Go to the MySQL web site and select the version that matches your version of Mac OS. Select the DMG archive version. After the DMG file finishes downloading click on it to open. Then open the installer inside and follow the installation steps.
Warning! Because Oracle has changed the MySQL installer and the default parameters of the MySQL server in newer versions the following steps may no longer work. These steps were tested with MySQL server version 5.5.48 for Mac OS 10.9 (which should work on newer versions too). Please download and install version 5.5.48 to make sure that all the steps will work correctly. If for some reason the installer is no longer available on the MySQL web site you can download it from here.After the installation has finished, open the System Preferences and you should see the MySQL icon. Click on it to open the MySQL server preferences. Now press the Start MySQL server button so MySQL would actually start working. Make sure to leave the checkbox “Automatically Start MySQL Server on Startup” so you won’t have to do that again.
Now comes the tricky part. By default MySQL server installs without password and does not restrict access to the information on it. This is not a great idea for us because your information is sensitive and we don’t want the whole world to be able to access it.
For the next part you need to open the Terminal app.
- To open the Terminal app click on the magnifying glass icon on the top right on your mac. This will open Spotlight.
- Type terminal in the search field.
- When the Terminal app appears in the list, select it by pressing Enter.
In the Terminal screen, type these commands and press Enter after each one of them:
This will change the current directory to the one where MySQL server is installed
This command will ask for your computer password. While typing it no characters will be displayed which is normal so don’t worry. Press Enter when finished. This will start a script which will ask you several questions and then reconfigure MySQL.
Mysql Server Download Mac
Set root password? [Y/n]
Select Y and press Enter. After that enter a password for MySQL and press Enter. Re-enter the password and press Enter again. This will be the password that IncoPOS will need when connecting to MySQL server.Remove anonymous users? [Y/n]
Select Y and press Enter. You don’t need anyone but you or someone you told your password to touch your data.
Disallow root login remotely? [Y/n]
Here you have to decide. If you have more than one computer that will be using this data then answer n. If this information will be accessed only from this computer then select Y. In all cases this can later be changed by using the same commands.
Remove test database and access to it? [Y/n]
Select Y and press Enter. You don’t need that test database so it is safe to remove it.
Mysql Server Download Mac M1
Reload privilege tables now? [Y/n]
Download Mysql Server 5.6 For Mac
Select Y and press Enter. This will make the changes you did effective now.
Download Mysql Server For Mac
This is it! Now you have MySQL installed and secured on your Mac.