使用brew安装
- 执行brew命令
brew install mysql
- 创建或修改/usr/local/etc/my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock
default-character-set = utf8
[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8
init-connect ='SET NAMES utf8'
max_allowed_packet = 64M
bind-address = 127.0.0.1
port = 3306
socket = /tmp/mysql.sock
innodb_file_per_table=1
[mysqld_safe]
timezone = '+0:00'
- 数据库初始化
unset TMPDIR
- 启动mysql服务
mysql.server start
-
按提示设置mysql安全
-
连接数据库测试