Mac下安裝mysql8.0.11


1、下載MySQL Community 版本:8.0.11,本次例子是以dmg安裝的方式,下載的文件名為:mysql-8.0.11-macos10.13-x86_64.dmg

  下載地址:https://dev.mysql.com/downloads/mysql/  下載需要自己登錄oracle賬號

2、下載后雙擊安裝,安裝的時候指設置下mysql root密碼

3、用工具鏈接mysql,如果出現提示:

  Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found

  需要重新配置下密碼方式

  配置如下:

  • 點擊左上角蘋果圖標,進入系統偏好設置
  • 點擊底下部分MySQL提示
  • 點擊Initialize Database,初始化數據庫
  • 在Please enter a password for the database "root" user: 輸入框中輸入密碼
  • 選中Use Legacy Password Encryption后在點擊OK按鈕
  • 彈出框中輸入系統管理員密碼
  • 初始化后再再MySQL頁面點擊 Start MySQL Server 按鈕,啟動mysql。在用客戶端連服務端,就能正常連接了

4、安裝完成后,在命令行中輸入mysql命令,提示:-bash: /usr/local/bin/mysql: No such file or directory

  需要把安裝的bin的路徑放到環境變量中去,設置方法:

  • 用戶home 目錄下 在.bash_profile 文件中 添加一行   export PATH=$PATH:/usr/local/mysql-8.0.11-macos10.13-x86_64/bin
  • 再執行命令: source .bash_profile 讓設置的環境變量生效

到這一步,整個安裝mysql 都完成了並能正常使用

 安裝完成后,登錄mysql ,通過source 命令導入sql文件:

C02M71L9F8J2:Downloads pub_pawf_autotest$ mysql -u root -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 22

Server version: 8.0.11 MySQL Community Server - GPL

 

Copyright (c) 2000, 2018, 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> source 20180407.sql

Query OK, 0 rows affected, 1 warning (0.00 sec)

 

Query OK, 0 rows affected (0.00 sec)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM