打開my.ini文件,相關(guān)配置修改如下 [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 = ..... basedir ="C:\Program Files (x86)\mysql-5.6.26-winx64" # datadir = ..... datadir ="C:\Program Files (x86)\mysql-5.6.26-winx64\data" # port = ..... # 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=utf8 [client] #客戶端編碼方式,最好和服務(wù)端保存一致 loose-default-character-set = utf8 [WinMySQLadmin] Server = "C:\Program Files (x86)\mysql-5.6.26-winx64\bin\mysqld.exe" 上面設(shè)置為了保證服務(wù)正常運(yùn)行,根據(jù)自己需要調(diào)整參數(shù),修改后要重啟服務(wù)。 //////////////////////////////////////////////以下分開 由于工作需要最近要開始研究MySQL了,私建立個(gè)人服務(wù)數(shù)據(jù)庫用于學(xué)習(xí),故此有此文章 方法/步驟數(shù)據(jù)庫下載
Mysql官方網(wǎng)站:http://www./,數(shù)據(jù)庫下載地址:http://www./downloads
/。從官方網(wǎng)站可以找到兩種文件包,一種是exe安裝程序,另一種是zip壓縮包。本人喜歡清爽的方式,所以下載的是ZIP壓縮包。最新的5.6.26大
概350M.不需要注冊(cè)直接下載綠色版 。 數(shù)據(jù)庫安裝
解壓出下載的文件mysql-5.6.26-winx64.zip(有x86和x64兩個(gè)版本)到任一目錄,防止出現(xiàn)未知問題,最好放在非系統(tǒng)盤的非中
文目錄下,我的位置C:\Program
Files\mysql-5.6.26-winx64。打開文件夾復(fù)制一份my-default.ini為my.ini的配置文件。 打開my.ini文件,相關(guān)配置修改如下 [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 = ..... basedir ="C:\Program Files (x86)\mysql-5.6.26-winx64" # datadir = ..... datadir ="C:\Program Files (x86)\mysql-5.6.26-winx64\data" # port = ..... # 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=utf8 [client] #客戶端編碼方式,最好和服務(wù)端保存一致 loose-default-character-set = utf8 [WinMySQLadmin] Server = "C:\Program Files (x86)\mysql-5.6.26-winx64\bin\mysqld.exe" 上面設(shè)置為了保證服務(wù)正常運(yùn)行,根據(jù)自己需要調(diào)整參數(shù),修改后要重啟服務(wù)。 注冊(cè)Mysql服務(wù)
開始——運(yùn)行——cmd(管理員權(quán)限),然后cd到mysql安裝目錄的bin下面,我的目錄就是“C:\Program
Files\mysql-5.6.26-winx64\bin”,然后執(zhí)行mysqld
-install,提示服務(wù)安裝成功!運(yùn)行services.msc一看,確實(shí)有一個(gè)名為MySQL的服務(wù)了,啟動(dòng)它。有時(shí)啟動(dòng)失敗,根據(jù)情況調(diào)整參數(shù)即
可。 到這兒mysql安裝就算完成了,其實(shí)還挺簡(jiǎn)單的,但如果沒有操作過,整個(gè)過程估計(jì)要花不少時(shí)間,也是成長(zhǎng)必須的過程。 登錄維護(hù)Mysql 安裝成功了,也啟動(dòng)了,怎么登錄???用戶名和密碼是什么 ? MySQL的默認(rèn)用戶名是root,密碼為空。 怎么登錄?還是開始——運(yùn)行——cmd,cd到bin目錄下,然后執(zhí)行“mysql -u root -p”,提示輸入密碼,由于第一次運(yùn)行,密碼為空可以直接回車。 這一步設(shè)置密碼很關(guān)鍵 ,請(qǐng)仔細(xì)閱讀 還
是給數(shù)據(jù)庫設(shè)個(gè)密碼吧。輸入exit退出登錄。然后運(yùn)行運(yùn)行C:\Program
Files\mysql-5.6.22-win32\bin\mysqladmin -uroot -p password <新密碼>
,將<新密碼>替換為你的自定義密碼,然后按回車。這時(shí)會(huì)提示輸入密碼,其實(shí)是指的原密碼,原密碼因?yàn)槭强?,所以這里再回車即可完成設(shè)置。然
后用上面的方法和新密碼登入mysql,即可正常工作。 運(yùn)行"show variables like '%version%'" 查看數(shù)據(jù)庫相關(guān)信息 7 至此,整個(gè)數(shù)據(jù)庫的安裝完成。 雖然mysql客戶端能完成所有關(guān)于數(shù)據(jù)庫操作,但是黑黑的命令行界面還是讓很多人望而卻步,學(xué)習(xí)曲線直線上升,在此給大家推薦一個(gè)工具Navicate for mysql,個(gè)人感覺非常好用,各種操作一目了然,還有個(gè)SQLyog也不錯(cuò)。
備注:如果遷移綠色版的mysql : 1.需要先注冊(cè)Mysql服務(wù)
開始——運(yùn)行——cmd(管理員權(quán)限),然后cd到mysql安裝目錄的bin下面,我的目錄就是“C:\Program
Files\mysql-5.6.26-winx64\bin”,然后執(zhí)行mysqld
-install,提示服務(wù)安裝成功!運(yùn)行services.msc一看,確實(shí)有一個(gè)名為MySQL的服務(wù)了,啟動(dòng)它(切記安裝服務(wù)成功后必須要啟動(dòng))。
|