Mac 下安裝 MySQL 經曆

來源:互聯網
上載者:User

標籤:驗證   span   ima   this   guess   ora   tmp   default   any   

1.使用 homebrew 安裝:

brew install mysql

結果報錯:

$ brew install mysql==> Downloading http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19.tar.gz/from/http://cdn.mysql.com/curl: (22) The requested URL returned error: 404 Not FoundError: Download failed: http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19.tar.gz/from/http://cdn.mysql.com/

這時升級一下你的 homebrew:

brew update

安裝完成後,然後又報錯:

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/man/man8/mysqld.8
/usr/local/share/man/man8 is not writable.

真是坎坷。。。

解決方案:

#開啟許可權 $ sudo chown -R $(whoami) /usr/local/ #重新link一次 $ brew link mysql

這下總算安裝完成了。

 

2.配置 mysql :

進入 sql 指令模式:

mysql -uroot -p

然後報錯:

Error: Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)

表明我們沒有啟動 mysql 服務。

所以啟動服務:

mysql.server start

 

3.設定 root 賬戶密碼:

mysql_secure_installation

 

然後出現下列配置選項:

(1)

VALIDATE PASSWORD PLUGIN can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to set only those passwords which aresecure enough. Would you like to setup VALIDATE PASSWORD plugin?Press y|Y for Yes, any other key for No:Please set the password for root here.New password:Re-enter new password:

詢問你是否安裝 VALLDATE PASSWORD 這個套件(可以協助你驗證密碼的複雜度,設定的太簡單會提醒你),我並沒有安裝這個套件,直接 enter 後輸入兩次密碼結束。

(2)

By default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.Remove anonymous users? (Press y|Y for Yes, any other key for No) :

是否移除匿名使用者?選 y 。

(3)

Normally, root should only be allowed to connect from‘localhost‘. This ensures that someone cannot guess atthe root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) :

是否關閉 root 遠端登入?選 y 。

(4)

By default, MySQL comes with a database named ‘test‘ thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) :

是否移除測試資料庫?選 y 。

(5)

Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) :

是否直接重新讀取許可權?選 y 。

 

4.再次嘗試進入 sql 指令模式:

mysql -uroot -p

成功!

 

到這步我們便完成了 MySQL 的安裝。

Mac 下安裝 MySQL 經曆

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.