MySQL數據庫管理軟件有兩種版本,一種是企業版,一種是社區版,其中,前者是收費的,如果是個人使用的,社區版足矣。下載mysql-5.7.17-winx64.zip,并將之解壓于自己選定的目錄后,如圖1,會在文件夾里看到配置文件my-default.ini,此時,需將其復制,并粘貼進bin文件夾里,并將其重新命名為my.ini,如圖2。至此準備工作完成,下面將詳說具體的配置過程。

工具/原料
(1)電腦:Lenovo B460e;
(2)操作系統:windows 7,64位;
(3)mysql-5.7.17-winx64.zip。
方法/步驟
(1)配置系統環境變量;1、添加新的系統環境變量MYSQL_HOME,值為:
【C:/Program Files/MySQL/mysql-5.7.17-winx64】;
2、編輯系統環境變量path,添加如下代碼(包括冒號“;”):【%MYSQL_HOME%/bin;】。
(2)根目錄下的my-default.ini不動,配置bin文件夾中的my.ini,把my.ini文件中的內容改為如下內容:
my.ini:
| # For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the# *** default location during install, and will be replaced if you# *** upgrade to a newer version of MySQL.[cilent]port=3306default_character_set=utf-8[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 = %MYSQL_HOME%datadir = %MYSQL_HOME%dataport = 3306server_id = 10default_character_set = utf-8max_connections = 200# 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 = 512Msort_buffer_size = 8Mread_rnd_buffer_size = 8M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES |
對my.ini配置文件的一些理解:
1.innodb_buffer_pool_size:個人建議設置為設置為操作系統內存的50%。如果設置過大,MySQL可能會 占用系統交換空間,導致系統變慢,從而降低查詢效率;
2.basedir : 就是之前設置的環境變量;
3.server_id :關于主從復制的,應該是隨便設, 但必須保持唯一;
4.datadir:后續初始化等數據都會保存在該文件下,該文件后續操作會自動建立;
5.port:連接數據庫的端口號,3306即可,MySQL在線安裝的默認就為3306;
新聞熱點
疑難解答