Fading Coder

One Final Commit for the Last Sprint

Home > Notes > Content

Setting Up MySQL on macOS via Installer and Homebrew

Notes 2

Deploying via Official DMG Archive

Retrieve the latest Comunity Server build from the official distribution portal. During the setup wizard, explicitly select Legacy Password Encryption when prompted for the root credential to ensure backward compatibility with older client utilities.

Resolving PATH Limitations Executing client commands direct in the terminal may trigger a command not found error because the executable resides outside standard system directories. Resolve this by creating a symbolic link to expose the binary globally:

MYSQL_BIN_DIR="/usr/local/mysql/bin"
cd /usr/local/bin
ln -sf "${MYSQL_BIN_DIR}/mysql" .
ln -sf "${MYSQL_BIN_DIR}/mysqld" .
ln -sf "${MYSQL_BIN_DIR}/mysqladmin" .

Updating Authentication Protocol Modern releases enforce caching_sha2_password as the default authentication mechanism. Many third-party ORMs and GUI clients still require the traditional plugin. Switch the administrative account back to legacy encryption:

ALTER USER 'root'@'localhost' 
IDENTIFIED WITH mysql_native_password BY 'YourSecurePassword';
FLUSH PRIVILEGES;

Deploying via Homebrew

Package Acquisition & Service Control Utilize the package manager to fetch and configure the server:

brew install mysql

Manage background processes through native service managers:

# Launch daemon
brew services start mysql
# Terminate daemon
brew services stop mysql

Security Hardening Execute the built-in security script to apply production-ready constraints:

mysql_secure_installation

The utility presents an interactive prompt chain:

  1. Decline the password validation module to bypass minimum length requirements.
  2. Define a robust administrative credential when requested.
  3. Confirm deletion of anonymous accounts (y).
  4. Restrict remote root access (y restricts to localhost only; adjust based on network topology).
  5. Eliminate the default sample database (y).
  6. Apply privilege grants immediately (y).

Operational Verification Validate connectivity and monitor process lifecycle:

# Authenticate session
mysql -u root -p

# Check active threads
ps aux | grep mysqld | grep -v grep

# Review service state
brew services list | grep mysql
Tags: MySQLmacos

Related Articles

Designing Alertmanager Templates for Prometheus Notifications

How to craft Alertmanager templates to format alert messages, improving clarity and presentation. Alertmanager uses Go’s text/template engine with additional helper functions. Alerting rules referenc...

Deploying a Maven Web Application to Tomcat 9 Using the Tomcat Manager

Tomcat 9 does not provide a dedicated Maven plugin. The Tomcat Manager interface, however, is backward-compatible, so the Tomcat 7 Maven Plugin can be used to deploy to Tomcat 9. This guide shows two...

Skipping Errors in MySQL Asynchronous Replication

When a replica halts because the SQL thread encounters an error, you can resume replication by skipping the problematic event(s). Two common approaches are available. Methods to Skip Errors 1) Skip a...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.