mac 通过 brew 安装 mysql

  • 发布时间 2013-11-06
  • 分类 php

通过 brew 安装 mysql

brew install mysql

查看mysql版本

mysql -v

在 /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'
</code>
</pre>

执行

mysql_install_db --verbose --user=`MAC名` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

修改php.ini

pdo_mysql.default_socket= /tmp/mysql.sock

启动

mysql.server start