安装
常规安装命令
brew install mysql
如果想了解更多安装选项,可以通过brew info命令来查看。
安装后
-
查看安装了哪些文件到文件系统
brew list mysql
-
进入mysql文件夹根目录,注意当前系统安装的mysql版本号
cd /usr/local/Cellar/mysql/5.5.29/ unset TMPDIR ./bin/mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
以上命令执行成功后的结果类似如下:
Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: ./bin/mysqladmin -u root password 'new-password' ./bin/mysqladmin -u root -h localhost password 'new-password' Alternatively you can run: ./bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd . ; ./bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd ./mysql-test ; perl mysql-test-run.pl Please report any problems with the ./bin/mysqlbug script!
-
添加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