win10 安裝MySQL過程和遇到的坑

環境:win10系統,MySQL5.7.18 「mysql-5.7.18-winx64.msi」mysql

首先是要運行mysql-5.7.18-winx64.msi,選擇安裝在C盤(可自定義安裝)sql

 

第一步數據庫

打開命令控制檯Cmd ,並進入MySQL安裝目錄bin目錄中工具

C:\Users\Administrator.JX-201906191059>cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"編碼

 

第二步:安裝MySQL服務(不進行這步,MySQL不會在服務中)spa

C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld --install3d

Service successfully installed.日誌

 

第三步:初始化數據庫,在這以前須要先建立my.ini配置文件,放在MySQL安裝目錄server

#### my.ini文件 start #### 更多配置請百度!!!
[client]blog

port = 3306

default-character-set=utf8  

[mysqld]

skip-grant-tables

port = 3306

character_set_server=utf8

#安裝目錄

basedir=C:\Program Files\MySQL\MySQL Server 5.7

#data目錄與安裝目錄分離

datadir=F:\MySQL\data

 

#紅色參數解決下面  #錯誤一

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER

#如下配置,詳情能夠百度。

key_buffer_size = 16M

max_allowed_packet = 1M

sort_buffer_size = 512K

net_buffer_length = 8K

read_buffer_size = 256K

read_rnd_buffer_size = 512K

myisam_sort_buffer_size = 8M

explicit_defaults_for_timestamp=true 

#錯誤日誌文件

log-error=F:/MySQL/log/mysql-err.log

#### my.ini文件 END ####

 

#錯誤一

C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld --initialize

2019-06-24T02:37:29.141533Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2019-06-24T02:37:29.142503Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.

2019-06-24T02:37:29.142503Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.

2019-06-24T02:37:29.142503Z 0 [ERROR] Can't find error-message file 'D:\Program Files\MySQL\MySQL Server 5.7\share\errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.

2019-06-24T02:37:29.146523Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.

2019-06-24T02:37:29.146523Z 0 [ERROR] Aborting

 

#錯誤二,由於data目錄有文件(以前操做生成的,刪除便可)

C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld --initialize

2019-06-24T02:41:50.026106Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.

2019-06-24T02:41:50.027134Z 0 [ERROR] Aborting

 #初始化數據庫

C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld --initialize

啓動MySQL:

恭喜 MySQL服務能夠使用了

客戶端工具推薦:

好用纔是王道……

祝你在編碼路上,少走彎路……加油!

相關文章
相關標籤/搜索