MySQL在Windows上安裝多個例項的方法

dbasdk發表於2017-04-19

MySQL在Windows上安裝多個例項的方法


Step 1: 解壓MySQL安裝包,配置my.ini檔案,注意port不能設定為預設的3306,這裡我們設定為3307埠:

點選(此處)摺疊或開啟

  1. basedir = E:\MySQL\mysql-5.7.17-win32
  2. datadir = E:\MySQL\mysql-5.7.17-win32\data
  3. log_bin
  4. server_id=5717
  5. port = 3307

 Step 2: 開啟CMD視窗,進入到安裝路徑的bin目錄,這裡為:E:\MySQL\mysql-5.7.17-win32\bin,執行如下命令:

點選(此處)摺疊或開啟

  1. mysqld --initialize-insecure
  2. mysqld install MySQL5711
 Step 3: 執行成功後啟動MySQL,並更新相應的密碼,注意這裡的初始密碼為空

點選(此處)摺疊或開啟

  1. mysql -uroot -P3307 -p
  2. update mysql.user set authentication_string=password("lhr") where user="root";
  3. update mysql.user set Host="%" where Host="127.0.0.1";
  4. update mysql.user set Host="%" where Host="localhost";
  5. flush privileges
 Step 4: 驗證登入:mysql -uroot -plhr -P3307

點選(此處)摺疊或開啟

  1. E:\MySQL\mysql-5.7.17-win32\bin>mysql -uroot -plhr -P3307
  2. mysql: [Warning] Using a password on the command line interface can be insecure.
  3. Welcome to the MySQL monitor. Commands end with ; or \g.
  4. Your MySQL connection id is 5
  5. Server version: 5.7.17-log MySQL Community Server (GPL)

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

  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.

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

  11. mysql> status
  12. --------------
  13. mysql Ver 14.14 Distrib 5.7.17, for Win32 (AMD64)

  14. Connection id: 5
  15. Current database:
  16. Current user: root@localhost
  17. SSL: Not in use
  18. Using delimiter: ;
  19. Server version: 5.7.17-log MySQL Community Server (GPL)
  20. Protocol version: 10
  21. Connection: localhost via TCP/IP
  22. Server characterset: latin1
  23. Db characterset: latin1
  24. Client characterset: gbk
  25. Conn. characterset: gbk
  26. TCP port: 3307
  27. Uptime: 4 min 40 sec

  28. Threads: 1 Questions: 14 Slow queries: 0 Opens: 116 Flush tables: 1 Open tables: 109 Queries per second avg: 0.050
  29. --------------

  30. mysql> select @@version;
  31. +------------+
  32. | @@version |
  33. +------------+
  34. | 5.7.17-log |
  35. +------------+
  36. 1 row in set (0.00 sec)

  37. mysql>


  38. mysql> show variables like '%server_id%';
  39. +----------------+-------+
  40. | Variable_name | Value |
  41. +----------------+-------+
  42. | server_id | 5717 |
  43. | server_id_bits | 32 |
  44. +----------------+-------+
  45. 2 rows in set, 1 warning (0.02 sec)

  46. mysql> show variables like 'port';
  47. +---------------+-------+
  48. | Variable_name | Value |
  49. +---------------+-------+
  50. | port | 3307 |
  51. +---------------+-------+
  52. 1 row in set, 1 warning (0.01 sec)


 安裝完畢。效果圖:




About Me

...............................................................................................................................

本文作者:小麥苗,只專注於資料庫的技術,更注重技術的運用

本文在itpubhttp://blog.itpub.net/26736162)、部落格園http://www.cnblogs.com/lhrbest和個人微信公眾號(xiaomaimiaolhr)上有同步更新

本文itpub地址:http://blog.itpub.net/26736162/viewspace-2136081/

本文部落格園地址:http://www.cnblogs.com/lhrbest

本文pdf小麥苗雲盤地址:http://blog.itpub.net/26736162/viewspace-1624453/

● QQ群:230161599     微信群:私聊

聯絡我請加QQ好友(646634621),註明新增緣由

2017-03-25 09:00 ~ 2017-03-25 22:00魔都完成

文章內容來源於小麥苗的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解

版權所有,歡迎分享本文,轉載請保留出處

...............................................................................................................................

拿起手機使用微信客戶端掃描下邊的左邊圖片來關注小麥苗的微信公眾號:xiaomaimiaolhr,掃描右邊的二維碼加入小麥苗的QQ群,學習最實用的資料庫技術。

MySQL在Windows上安裝多個例項的方法
DBA筆試面試講解
歡迎與我聯絡

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26736162/viewspace-2136081/,如需轉載,請註明出處,否則將追究法律責任。

相關文章