前言:
因為用mac開發(fā),使用dmg鏡像安裝經(jīng)常失敗侯繁。
MySQL啟動出現(xiàn)The server quit without updating PID file (/usr/local/mysql/data/sunyudeMacBook-Pro.local.pid)
現(xiàn)象:
1 sudo /usr/local/mysql/support-files/mysql.server start? 提示?The server quit without updating PID file
?2 點擊 系統(tǒng)偏好設(shè)置里的? mysql 沒有看到正常的啟動頁面挂据?以清??
解決方法:
下載 mysql 的版本是不是和你機(jī)器的版本不一樣崎逃?
比如你的系統(tǒng)是 mac os 10.11掷倔,你下了一個要求10.14 的mysql 。是啟動不了的婚脱。
在這里選版本:https://downloads.mysql.com/archives/community/
安裝過程中將密碼保存下來今魔!
3勺像、配置
打開終端障贸,進(jìn)入MySQL安裝目錄/usr/local/mysql,進(jìn)入bin目錄吟宦,執(zhí)行mysql -u root -p登錄語句
系統(tǒng)提示“-bash:mysql:command not found”錯誤篮洁,原因是因為執(zhí)行命令時系統(tǒng)會主動到環(huán)境變量$PATH下尋找命令,如果沒有找到命令則提示不存在殃姓,因為在安裝MySQL之后我們沒有對MySQL進(jìn)行配置袁波,所以系統(tǒng)找不到mysql命令瓦阐。
/etc/paths - 建議修改,方法簡單
1)文件構(gòu)成
執(zhí)行vi /etc/paths之后呈現(xiàn):
/usr/local/bin
/usr/bin
/bin
/usr/sbin
(2)級別:實質(zhì)上這就是個系統(tǒng)全局的路徑篷牌,不建議做直接改動睡蟋,具體改動的方法兩個。
(3)修改方法:就是加載路徑
1.創(chuàng)建一個文件:
sudo touch /etc/paths.d/mysql
2.用 vim 打開這個文件(如果是以 open -t 的方式打開枷颊,則不允許編輯):
sudo vim /etc/paths.d/mysql
3.編輯該文件戳杀,鍵入路徑并保存(關(guān)閉該 Terminal 窗口并重新打開一個,就能使用 mysql 命令了)
/usr/local/mysql/bin
或者
sudo -s 'echo "/usr/local/sbin/mypath" > /etc/paths.d/mypath'
保存退出之后,重新打開新的命令窗口夭苗,
通過mysql -uroot -p登錄mysql, 輸入之前保存的密碼
修改登錄密碼:
sunyudeMacBook-Pro:~ sunyu$ mysql -u root -p
Enter password:?
Welcome to the MySQL monitor.? Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.12
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('aa123123');
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql>?
4信卡、使用MySQL Workbench管理MySQL數(shù)據(jù)庫