Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For your information, below is based on MySQL 8 and Mac OS X. There are two different approach to install MySQL on MAC, but I will talk about the installation based on brew here.


Install MySQL by brew

Code Block
sudo brew install mysql


If you want to allow connection from other servers, you need to modify /usr/local/Cellar/mysql/8.0.19/homebrew.mxcl.mysql.plist and bind-address=0.0.0.0 as following:

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>KeepAlive</key>
  <true/>
  <key>Label</key>
  <string>homebrew.mxcl.mysql</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/opt/mysql/bin/mysqld_safe</string>
    <string>--datadir=/usr/local/var/mysql</string>
    <string>--bind-address=0.0.0.0</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>WorkingDirectory</key>
  <string>/usr/local/var/mysql</string>
</dict>
</plist>

MySQL server I used is 8.0.19, so the directory path for homebrew.mxcl.mysql.plist could be different than mine.


If you need to modify my.cnf, you will need to create it by vi /etc/my.cnf

Code Block
#
# created by Chun Kang 2020-03-09
# based on the guide at https://confluence.atlassian.com/doc/database-setup-for-mysql-128747.html
#

[client]
port=3306
socket=/tmp/mysql.sock

[mysqld]
port=3306
bind-address=0.0.0.0
skip-name-resolve

character-set-server=utf8mb4
collation-server=utf8mb4_bin
default-storage-engine=INNODB
max_allowed_packet=256M
innodb_log_file_size=2GB
transaction-isola-isolation=READ-COMMITTED
binlog_format=row
default_time_zone='+09:00'
max_connections=4096

Start MySQL

Code Block
sudo /usr/local/mysql/support-files/mysql.server start

...