1. 解壓zip包到安裝目錄
首先,將mysql/49300.html">mysql-8.0.11-winx64.zip 解壓縮到 安裝D:/mysql-8.0.11-winx64 目錄下,
2.配置文件
在安裝根目錄下添加 my.ini
基本配置文件(my)
[mysqld]basedir = D:/mysql-8.0.11-winx64datadir = D:/mysql-8.0.11-winx64/dataport = 3306lower_case_table_names = 2default_authentication_plugin=mysql_native_password
參考 基本配置:
[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 = D:/Program/MySQLdatadir = D:/DBs/MySQLport = 3306# server_id = .....# 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 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES character-set-server = utf8mb4performance_schema_max_table_instances = 600table_definition_cache = 400table_open_cache = 256[mysql]default-character-set = utf8mb4[client]default-character-set = utf8mb4
3.初始化數據庫
在MySQL安裝目錄的 bin 目錄下執行命令:
mysqld --initialize --console
執行完成后,會打印 root 用戶的初始默認密碼,比如:
2018-04-20T02:35:01.507037Z 0 [Warning] [MY-010915] [Server] '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.2018-04-20T02:35:01.507640Z 0 [System] [MY-013169] [Server] D:/Program/MySQL8/bin/mysqld.exe (mysqld 8.0.11) initializing of server in progress as process 110642018-04-20T02:35:01.508173Z 0 [ERROR] [MY-010340] [Server] Error message file 'D:/Program/MySQL/share/english/errmsg.sys' had only 1090 error messages, but it should contain at least 4512 error messages. Check that the above file is the right version for this program!2018-04-20T02:35:05.464644Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: APWCY5ws&hjQ2018-04-20T02:35:07.017280Z 0 [System] [MY-013170] [Server] D:/Program/MySQL8/bin/mysqld.exe (mysqld 8.0.11) initializing of server has completed
其中,第4行的“APWCY5ws&hjQ”就是初始密碼,在沒有更改密碼前,需要記住這個密碼,后續登錄需要用到。
如果沒記住,那也沒事,刪掉初始化的 datadir 目錄,再執行一遍初始化命令,又會重新生成的。當然,也可以使用安全工具,強制改密碼,用什么方法,自己隨意。
4.安裝服務
在MySQL安裝目錄的 bin 目錄下執行命令:
mysqld --install [服務名]
4.啟動服務
net start MySQL
更改密碼和密碼認證插件
在MySQL安裝目錄的 bin 目錄下執行命令:
mysql -uroot -p
這時候會提示輸入密碼,記住了第3步的密碼,填入即可登錄成功,進入MySQL命令模式。
之前,MySQL的密碼認證插件是“mysql_native_password”,而現在使用的是“caching_sha2_password”。
因為當前有很多數據庫工具和鏈接包都不支持“caching_sha2_password”,為了方便,我暫時還是改回了“mysql_native_password”認證插件。
在MySQL中執行命令:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
修改密碼驗證插件,同時修改密碼。
如果想默認使用“mysql_native_password”插件認證,可以在配置文件中配置default_authentication_plugin項。
[mysqld]default_authentication_plugin=mysql_native_password
總結
以上所述是小編給大家介紹的MySql 8.0.11-Winxp64(免安裝版)配置教程,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對VeVb武林網網站的支持!
|
新聞熱點
疑難解答