How To Use MySql On Mac

MySql is a very popular relational sql database server software. It is widely used in huge of websites as the database server. This article will tell you how to install MySql database server and GUI client tool on MacOS to make MySql database management easily.

1. Install MySql Database Server On Mac.

  1. Download MySql Server community version for MacOS.
  2. Click the downloaded dmg file to open the MySql server installer package.
    double click mysql installer package to install
  3. Click Next button in the wizard dialog until go to the Change Install Location… dialog, then click Install button to install it.
    change install location before install
  4. After installation, it will display Configure MySQL Server dialog, input root user’s password. And click Finish button to complete MySql server installation.
    insert root user password
  5. Now MySql server has been installed successfully.
    mysql installation successful

2. Start, Stop, Configure MySql Server.

  1. Open MacOS System Preferences.
    mysql is installed in macos system preferences
  2. Click MySQL button to open MySQL configuration dialog. Then you can start, stop and configure MySQL server in it.
    start stop configure mysql server panel

3. Manage MySQL Database With MySQL Workbench.

  1. Download MySQL Workbench community version.
  2. Click the downloaded dmg file to install it.
  3. Open MySQL workbench application.
  4. Connect to the local MySQL database server.
  5. Click the Create a new schema in the connected server button to create a database.
    mysql workbench create database
  6. Input mysql database name and select database character set and collation. Click Apply button to create the database.
    mysql workbench input database name
  7. Right click the Tables item under dev2qa database then click Create Table… menu item to create table.
    mysql workbench create table
  8. Input table name at top text box. Then click table row to add one column, input column name, select datatype and other column options(Primary Key, Not Null, Unique, Auto Increment, Binary etc).
    mysql workbench add table column
  9. Right click user_account table, click Select Rows – Limit 1000 menu item to open edit table data dialog in right panel to insert data into the table.
    add row in mysql db table

4. Create MySQL User and Assign Privileges To The User.

  1. Click Users and Privileges menu item in left MySQL workbench panel.
    create mysql user and assign privileges to it
  2. Click Add Account button at the bottom of right panel.
  3. Input user name and password in the new panel.
  4. Click Administrative Roles tab to select related roles and assign them to the newly created MySQL user.
  5. Click Schema Privileges tab to assign MySQL database (schema) privileges to the user by click Add Entry… button. You can select all database, or special database either by matching string pattern or exactly string match.
  6. Then select desired Object Rights, DDL Rights or Other Rights checkboxes at bottom, then click Apply button to apply the selected privileges to the created user.

5. Create Example User Account Table.

In our mysql jdbc examples, we always use a table user_account, so we should create this table use MySQL workbench. Below is the table DDL sql code, you can also run it to create this table.

To execute below DDL code, just click Create a new SQL tab for executing queries button ( open mysql sql command execution window ) at mysql workbench tool bar top left corner to open a sql command execute window, and then copy below code into it. Then click execute button(the first lightning icon mysql execute sql code button) at the top tool bar of the sql window to execute the code.

mysql user_account example table columns

CREATE TABLE `user_account` (
`user_name` varchar(100) COLLATE utf8_bin NOT NULL,
`password` varchar(100) COLLATE utf8_bin NOT NULL,
`email` varchar(100) COLLATE utf8_bin NOT NULL,

5 thoughts on “How To Use MySql On Mac”

  1. I have a .sql database I download from my web host’s server. It’s from a old version of Zen Cart e-shop I created several years ago and there’s a PHP codebase problem. I need to rebuild the cart. Your instructions show only creating a new database, can I simply open this existing .sql database with Workbench to make edits or copy the data? Any advice would be appreciated.
    Thank you.

  2. Hi,
    I’ve just installed MySQL and MySQL Workbench. When I try to connect to Local Instance (mine is called Local Instance 3306), once I’ve typed the password (the one I chose for the Oracle account), there’s a popup reading :

    Authentication plugin ‘caching_sha2_password’ reported error: Authentication requires secure connection.

    Any idea how to move forward ?

  3. Please tell me how to install mysql database installation and its connection step by step for python and java.I have tried many times but i make some mistake.So i need your help.
    How to install mysql and connection for python GUI project?
    How to install oracle database and its connection for java JDK?

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.