溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Windows Server 2008怎么安裝MySQL Community Server 5.7.16

發布時間:2021-11-18 16:23:54 來源:億速云 閱讀:251 作者:iii 欄目:MySQL數據庫

本篇內容介紹了“Windows Server 2008怎么安裝MySQL Community Server 5.7.16”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

0.下載安裝介質

   我們可以登錄MySQL官網來下載安裝介質,網址是:http://dev.mysql.com/downloads/。我選擇的是64位壓縮包版本“Windows (x86, 64-bit), ZIP Archive”。

1.解壓縮

將下載到本地的安裝介質解壓縮。然后,將解壓后的文件夾mysql-5.7.16-winx64拷貝到安裝目錄(E盤根目錄)下。

2.設置系統環境變量

右鍵點擊 計算機>>屬性>> 高級系統屬性>>環境變量>> 編輯 Path ,在最后添加” ;E:\mysql-5.7.16-winx64\bin“,確定。

3.創建my.ini 文件和data目錄,配置安裝路徑與數據存儲路徑

在E:\mysql-5.7.16-winx64目錄下創建data目錄和my.ini,并在my.ini中配置安裝路徑與數據存儲路徑等信息。

點擊(此處)折疊或打開

  1. [mysql]

  2. default-character-set=utf8

  3. [mysqld]

  4. max_connections=200

  5. default-storage-engine=INNODB

  6. basedir =E:\mysql-5.7.16-winx64\bin

  7. datadir =E:\mysql-5.7.16-winx64\data

  8. port = 3306

4.安裝MySQL服務

首先,以管理員身份運行 cmd 并切換到MySQL的bin目錄下;

接下來,執行mysqld --initialize-insecure

    這條命令用來初始化data文件,其中insecure選項指定登錄無需口令。

點擊(此處)折疊或打開

  1. D:\>e:


  2. E:\>cd mysql-5.7.16-winx64


  3. E:\mysql-5.7.16-winx64>cd bin


  4. E:\mysql-5.7.16-winx64\bin>mysqld --initialize-insecure


  5. E:\mysql-5.7.16-winx64\bin>

需要注意的是,如果不指定insecure選項,則會隨機生成登陸密碼, 在E:\mysql-5.7.16-winx64\data文件夾下,有一個 hoegh.err 文件,其中hoegh是主機名,打開會看到:
2016-10-20T09:34:56.806257Z 1 [Note] A temporary password is generated for root@localhost: p-mcI:ijR6Xg,
其中 p-mcI:ijR6Xg即為隨機密碼。

然后,輸入 mysqld --install安裝MySQL服務

我們會看到界面出現:Server successfully installed,這就說明MySQL服務安裝成功。 

點擊(此處)折疊或打開

  1. E:\mysql-5.7.16-winx64\bin>


  2. E:\mysql-5.7.16-winx64\bin>mysqld --install

  3. Service successfully installed.


  4. E:\mysql-5.7.16-winx64\bin>

5.啟動MySQL服務

輸入  net start mysql  回車, 就會看到: MySQL 服務已經啟動成功。嘗試使用root用戶登錄數據庫,并通過show databases命令查看數據庫概要信息。

點擊(此處)折疊或打開

  1. E:\mysql-5.7.16-winx64\bin>

  2. E:\mysql-5.7.16-winx64\bin>net start mysql

  3. MySQL 服務正在啟動 .

  4. MySQL 服務已經啟動成功。



  5. E:\mysql-5.7.16-winx64\bin>mysql -u root

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

  7. Your MySQL connection id is 2

  8. Server version: 5.7.16 MySQL Community Server (GPL)


  9. Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


  10. Oracle is a registered trademark of Oracle Corporation and/or its

  11. affiliates. Other names may be trademarks of their respective

  12. owners.


  13. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


  14. mysql> show databases;

  15. +--------------------+

  16. | Database |

  17. +--------------------+

  18. | information_schema |

  19. | mysql |

  20. | performance_schema |

  21. | sys |

  22. +--------------------+

  23. 4 rows in set (0.00 sec)


  24. mysql>

6.修改root密碼

    安全起見,我們修改一下root密碼。

點擊(此處)折疊或打開

  1. mysql>

  2. mysql> alter user 'root'@'localhost' identified by 'root';

  3. Query OK, 0 rows affected (0.00 sec)


  4. mysql>

  5. mysql> exit

  6. Bye


  7. E:\mysql-5.7.16-winx64\bin>mysql -u root -proot

  8. mysql: [Warning] Using a password on the command line interface can be insecure.

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

  10. Your MySQL connection id is 4

  11. Server version: 5.7.16 MySQL Community Server (GPL)


  12. Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


  13. Oracle is a registered trademark of Oracle Corporation and/or its

  14. affiliates. Other names may be trademarks of their respective

  15. owners.


  16. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


  17. mysql> show databases;

  18. +--------------------+

  19. | Database |

  20. +--------------------+

  21. | information_schema |

  22. | mysql |

  23. | performance_schema |

  24. | sys |

  25. +--------------------+

  26. 4 rows in set (0.00 sec)


  27. mysql>

“Windows Server 2008怎么安裝MySQL Community Server 5.7.16”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女