通過 Homebrew 安裝 MySQL 的方法

2021-06-14 18:44:33 字數 1333 閱讀 8117

通過 homebrew 安裝 mysql 的方法:

1. install from brew

$ brew install mysql

2. 建立或修改/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'

3. init database

$ 

unset tmpdir

$ mysql_install_db --verbose --user=

`whoami` --basedir=

"$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

4. start mysql

$ mkdir -p ~/library/launchagents

$ cp /usr/local/cellar/mysql/5.5.20/homebrew.mxcl.mysql.plist ~/library/launchagents/

$ launchctl load -w ~/library/launchagents/homebrew.mxcl.mysql.plist

5. secure mysql

# 按照提示一步一步執行

$ mysql_secure_installation

6. change the root password if you need

$ mysqladmin -uroot -p'old_passowrd' password "new_password"

Mac OS X 通過Homebrew安裝Go

go 需要在根目錄下設定path.命令列 cd 然後 open zshrc貼上下面命令 go export goroot usr local opt go libexec export gopath home go export path path goroot bin gopath bin 儲存關...

Mac 通過 homebrew安裝Redis資料庫

redis 是完全開源免費的,遵守bsd協議的乙個高效能的key value資料庫。效能極高。redis能讀的速度是110000次 s,寫的速度是81000次 s 豐富的資料型別。redis支援二進位制案例的 strings,lists,hashes,sets 及 ordered sets 資料型別...

Mac下通過Homebrew安裝MySQL

安裝完成之後,安裝其他的軟體就特別方便了。執行 brew install mysql等成功安裝完成,結果想要登入的時候報了個錯誤 error 2002 hy000 can not connect to local mysql server through socket tmp mysql.sock ...