mac brew 安裝mysql及設定使用者

2021-09-29 20:54:37 字數 1015 閱讀 9704

安裝命令

brew install mysql

安裝目錄 /usr/local/cellar/mysql/5.7.21

啟動命令 mysql.server start

配置目錄 /usr/local/etc/my.cnf

啟動mysql後連線mysql,報錯

解決方式:

vim /usr/local/etc/my.cnf

在檔案末尾加上 skip-grant-tables

重新連線,發現又報錯,我擦~

原因是找不到sockt檔案,

在 /usr/local/etc/my.cnf 中再新增一行

socket = /tmp/mysql.sock
再啟動應該就可以了,如果還報上面的說明socket還是沒生成,

grep / -name mysql.sock 找到檔案位置,做個軟鏈到 /tmp/mysql.sock就行了

連線上mysql後,想設定使用者並賦權,又報錯!

error 1290 (hy000): the mysql server is running with the --skip-grant-tables option so it cannot execute this statement
這個時候只需要

flush privileges

終於ok了!

use mysql;

create user 'test'@'localhost' identified by 'root'; //就能建立乙個密碼是root的test使用者了

MAC brew軟體安裝

之前一直懷念ubuntu下的apt get,因為實在是方便,需要安裝什麼,乙個命令搞定,相關的依賴包統統由apt get 懷念apt get之餘,發現了替代工具macports,據說也可以解決我的問題。但可惜,我總是無法更新本地軟體索引庫!homebrew主頁 安裝brew 使用brew安裝軟體 使...

Mac brew方式安裝nginx

1 檢視本機是否安裝homebrew brew v如下圖所示 如果沒有安裝請先執行以下命令安裝homebrew 安裝command line tools xcode select install安裝brew命令 ruby e curl fssl 2 安裝nginx 安裝完成 測試一下 nginx v...

mac brew 安裝指定版本軟體

mac 中使用brew install 預設是安裝最新版本的。如何指定需要的版本呢?譬如本人安裝thrift。預設安裝最新的。通過brew info thrift 命令可以檢視安裝thrift的資訊。可以看到 from git clone 然後 git log formula thrift.rb g...