mysql下載安裝配置 5.7.26 / 5.7.X(免安裝版)詳細安裝教程

 

1、下載mysql,下載地址:https://downloads.mysql.com/archives/community/

選擇操作系統和版本,我是64位win10,點擊 Download 後會跳到Oracle登錄頁面要求登錄後才能下載

不想註冊oracle帳戶的,也可在直接在這裏下載:https://download.csdn.net/download/antma/12439797

我這裏下載的  5.7.26 ,基它 5.7.X 的安裝都是類似的,沒什麼區別。

 

2、下載完成後解壓:

 

 

 

3、在mysql目錄下手工創建 my.ini 文件,如上圖,文件內容如下,basedir 和 datadir 修改爲相應地址:

 

[mysql]
# 設置mysql客戶端默認字符集
default-character-set=utf8mb4
[mysqld]
#設置3306端口
port = 3308
# 設置mysql的安裝目錄
basedir=C:/tools/mysql-5.7.26-winx64
# 設置mysql數據庫的數據的存放目錄
datadir=C:/tools/mysql-5.7.26-winx64/data
# 允許最大連接數
max_connections=200
# 服務端使用的字符集默認爲8比特編碼的latin1字符集
character-set-server=utf8mb4
# 創建新表時將使用的默認存儲引擎
default-storage-engine=INNODB
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

 

4、cmd進入bin目錄下,執行 mysqld --initialize-insecure

 

\mysql-5.7.26-winx64\bin>mysqld --initialize-insecure

 

5、然後執行 mysqld -install

 

mysql-5.7.26-winx64\bin>mysqld -install

     提示 Service successfully installed ,即安裝成功

 

6、啓動服務 
 

\mysql-5.7.26-winx64\bin>net start mysql


7、停止服務

 

\mysql-5.7.20-winx64\bin>net stop mysql

 

8、登錄mysql

因爲上面初始化參數使用的 --initialize-insecure,所以登錄爲空密碼,直接  mysql -uroot -P3308 即可直接登錄:

C:\tools\mysql-5.7.26-winx64\bin>mysql -uroot -P3308
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.26 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, 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>
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql>
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>

9、修改mysql 密碼:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');

 

    完成!

 

注:如果出現安裝mysql Install/Remove of the Service Denied! 報錯的時候,在打開 cmd 時用管理員身份打開。

或如下提示也是需管理員身份:Could not create or access the registry key needed for the MySQL application
to log to the Windows EventLog. Run the application with sufficient
privileges once to create the key, add the key manually, or turn off

 

 

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