1. 程式人生 > >MySql8最新配置方式(完美)

MySql8最新配置方式(完美)

下載MYSQL8

地址:https://www.mysql.com/downloads/

1.滑動網頁到最下面,選擇Community (GPL) Downloads »

 

2.選擇MySQL Community Server 

 

3. 這裡依然選擇綠色手動的安裝方式:需要安裝包的選擇MSI安裝方式

正式安裝:

1. 選擇你的一個沒有中文的目錄解壓安裝:解壓後目錄如圖我所示:

2.重要配置檔案儲存為mysql.ini 放到mysql根目錄下面

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
basedir = "D:\DevTools\mysql-8.0.13-winx64"
datadir = "D:\DevTools\mysql-8.0.13-winx64\data\"
port = 3306
max_connections=1000
max_user_connections=500
wait_timeout=200
character-set-server=utf8
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 
#character-set-server=UTF-8
default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
#忘記密碼時使用
#skip-grant-tables
#設定協議認證方式(重點啊)
default_authentication_plugin=mysql_native_password
[mysql]
default-character-set=utf8

 

3.新增環境變數

實際上不新增環境變數也是可以的,這裡只是為了方便:我這裡的是安裝在這個目錄,只需要將他新增到你的path目錄即可

 

 

4.安裝服務 mysqld --install 服務名(可以不寫,預設是MySql,如果你的電腦上要安裝付哦個mysql,這裡的服務名寫一下做區分),安裝成功後控制它會提示:successful 

mysqld --install [服務名]

 5.執行安裝

 mysqld --initialize-insecure //這裡會等待一段時間,

 

 6.啟動服務(這時候不要去登入mysql,登入不進去的,必須要先啟動)

7.登入mysql

mysql -u root -p //初始化密碼為nULL

 

 8.如果你的連線客戶端出現2056錯誤那麼是不支援mysql8的通訊協議

# 執行下面的程式碼 
use mysql; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
# 如果你的客戶端支援 下面的也可以mysql7也是可以的

   SET PASSWORD = PASSWORD('123456'); 

 

好了!安裝完成!