Mac Pro 下MySql的安裝及配置使用

一、安裝:

https://dev.mysql.com/doc/refman/5.6/en/osx-installation-pkg.html 到這個網址下載,下載之後點擊安裝(傻瓜式安裝),
爲什麼我要寫這篇博客記錄下來呢?重點不是它的安裝,而是我遇到了一些問題,

二、配置

打開終端
打開配置
輸入:.bash_profile
這裏寫圖片描述
輸入:export PATH=${PATH}:/usr/local/mysql/bin 保存

然後,在系統偏好設置中打開MySql ,在終端進行登錄的時候會出現

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 

解決這個問題的辦法
1、打開終端輸入/usr/local/mysql/bin/mysqld_safe –skip-grant-tables
這裏寫圖片描述
出現上邊的結果,然後不要關閉當前的終端,重新打開一個 ,
2、輸入/usr/local/mysql/bin/mysql 會展示出

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.7.13 MySQL Community Server (GPL)

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> 

3、打開use mysql;
結果:

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

4、然後更改root的密碼

mysql> update user set authentication_string=password('root') where Host='localhost' and User='root';

5、退出保存,重新啓動服務 搞定

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章