DEV Community

Udara Dananjaya
Udara Dananjaya

Posted on

MySQL Development Setup – macOS Apple Silicon (ARM)

1. Download

For Mac Apple Silicon (ARM64), download MySQL from the official MySQL website:

MySQL Community Downloads – macOS ARM64

Required components:

  • MySQL Community Server – Database server
  • MySQL Workbench – Database management and development tool
  • MySQL Shell – Optional, useful for advanced MySQL administration

2. MySQL Server Installation

Install the downloaded MySQL Server .dmg package.

After installation, verify the MySQL binary:

ls -l /usr/local/mysql/bin/mysql
Enter fullscreen mode Exit fullscreen mode

Expected:

/usr/local/mysql/bin/mysql
Enter fullscreen mode Exit fullscreen mode

3. Configure MySQL PATH

The MySQL binary may not automatically be available from the terminal.

zsh

macOS normally uses zsh:

echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Bash

For Bash:

echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

Also add it to .bashrc if required:

echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

4. Verify MySQL Installation

Check the MySQL client:

which mysql
Enter fullscreen mode Exit fullscreen mode

Expected:

/usr/local/mysql/bin/mysql
Enter fullscreen mode Exit fullscreen mode

Check the version:

mysql --version
Enter fullscreen mode Exit fullscreen mode

Example:

mysql  Ver 8.x.x for macos...
Enter fullscreen mode Exit fullscreen mode

5. Connect to MySQL

Connect using the root account:

mysql -u root -p
Enter fullscreen mode Exit fullscreen mode

Enter the MySQL root password configured during installation.

After successful login:

SELECT VERSION();
Enter fullscreen mode Exit fullscreen mode

6. Check MySQL Server Status

The MySQL installer normally installs MySQL as a macOS service.

Check the process:

ps aux | grep mysqld
Enter fullscreen mode Exit fullscreen mode

You can also check MySQL from:

System Settings → MySQL

From there, you can start or stop the MySQL server.

7. MySQL Workbench

Install MySQL Workbench for the graphical database management interface.

Create a local connection with:

Connection Name: Local MySQL
Hostname:        127.0.0.1
Port:             3306
Username:        root
Password:        <your MySQL password>
Enter fullscreen mode Exit fullscreen mode

Then test the connection.

CLI connection

mysql -u root -p
Enter fullscreen mode Exit fullscreen mode

Workbench connection

MySQL Workbench
        ↓
Local MySQL
        ↓
127.0.0.1:3306
        ↓
root
Enter fullscreen mode Exit fullscreen mode

8. Create a Development Database

After connecting:

CREATE DATABASE dev_database;
Enter fullscreen mode Exit fullscreen mode

Check databases:

SHOW DATABASES;
Enter fullscreen mode Exit fullscreen mode

Select the database:

USE dev_database;
Enter fullscreen mode Exit fullscreen mode

9. Create a Development User

For application development, it is better to use a separate database user instead of using root.

CREATE USER 'devuser'@'localhost'
IDENTIFIED BY 'YourStrongPassword';
Enter fullscreen mode Exit fullscreen mode

Grant access:

GRANT ALL PRIVILEGES ON dev_database.*
TO 'devuser'@'localhost';
Enter fullscreen mode Exit fullscreen mode

Apply privileges:

FLUSH PRIVILEGES;
Enter fullscreen mode Exit fullscreen mode

Test:

mysql -u devuser -p dev_database
Enter fullscreen mode Exit fullscreen mode

10. Useful MySQL Commands

Check databases:

SHOW DATABASES;
Enter fullscreen mode Exit fullscreen mode

Select database:

USE dev_database;
Enter fullscreen mode Exit fullscreen mode

List tables:

SHOW TABLES;
Enter fullscreen mode Exit fullscreen mode

Check table structure:

DESCRIBE table_name;
Enter fullscreen mode Exit fullscreen mode

Check current user:

SELECT USER();
Enter fullscreen mode Exit fullscreen mode

Check server version:

SELECT VERSION();
Enter fullscreen mode Exit fullscreen mode

Exit MySQL:

EXIT;
Enter fullscreen mode Exit fullscreen mode

11. MySQL Configuration Location

The MySQL installation is commonly located at:

/usr/local/mysql/
Enter fullscreen mode Exit fullscreen mode

MySQL client:

/usr/local/mysql/bin/mysql
Enter fullscreen mode Exit fullscreen mode

MySQL configuration may be located at:

/etc/my.cnf
Enter fullscreen mode Exit fullscreen mode

or:

/usr/local/mysql/etc/my.cnf
Enter fullscreen mode Exit fullscreen mode

The exact configuration location can vary depending on the MySQL version and installation method.

12. Development Environment Summary

Component Purpose
MySQL Community Server Runs the local MySQL database
MySQL Workbench GUI for database development and administration
MySQL Client Terminal-based database access
MySQL Shell Advanced MySQL administration
Port 3306 Default MySQL port
/usr/local/mysql/bin MySQL command-line binaries

Quick verification

Run:

which mysql
mysql --version
mysql -u root -p
Enter fullscreen mode Exit fullscreen mode

For a working local development environment, all three commands should work successfully.

Top comments (0)