mysql 5.7.11 zip安裝配置方法圖文教程。本站提示廣大學習愛好者:(mysql 5.7.11 zip安裝配置方法圖文教程)文章只能為提供參考,不一定能成為您想要的結果。以下是mysql 5.7.11 zip安裝配置方法圖文教程正文
一、下載mysql 5.7.11 zip 安裝包
本機以win7 64位系統為例,如果是32位系統,請下載32位的安裝包
http://dev.mysql.com/downloads/mysql/
選擇 Windows (x86, 64-bit), ZIP Archive 下載包
二、解壓安裝包 | Extracting the Install Archive
D:\victor.min\software\mysql-5.7.11-winx64 #我的解壓目錄
三、創建一個空文件夾,命名為data, 也可以隨便命名,用來存放數據
# 本機創建在 D:\victor.min\software\mysql-5.7.11-winx64 目錄下,所以最後會看到 D:\victor.min\software\mysql-5.7.11-winx64\data #此文件夾後面會有用到
四、配置一個自己的啟動配置文件 | Creating an Option File
如果自己用沒什麼特別的,就把 D:\victor.min\software\mysql-5.7.11-winx64\my-default.ini 文件copy一份,重新命名為 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. [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 為安裝文件解壓後的目錄 | basedir和datadir 可以使用相對路徑 # basedir=./.. basedir=D:\\victor.min\\software\\mysql-5.7.11-winx64 # datadir 為用來存放數據的目錄 # datadir=./../data datadir=D:\\victor.min\\software\\mysql-5.7.11-winx64\\data # port 為端口號 port=3306 # mar_connections為最大連接數 max_connections=20 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 explicit_defaults_for_timestamp=true sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
五、初始化數據目錄 Initializing the Data Directory
當然,按照mysql官方文檔給出的步驟還有一步 Selecting a MySQL Server Type,就是選擇用 mysqld 還是 mysqld-debug |命令如下
mysqld --defaults-file="D:\victor.min\software\mysql-5.7.11-winx64\my.ini" --initialize-insecure
注:
1、這個命令很重要,它會初始化 data 目錄,在執行此命令前請先把data目錄下的所有文件先刪除,否則會失敗
2、可以選擇用 --initialize-insecure 或者 --initialize 來初始化,--initialize-insecure 初始化root密碼為空,如果用 --initialize來初始化,會產生一個隨機密碼
執行成功後你會在data目錄 下看到 mysql,perofrmance_schema,sys目錄,同時還會有一些文件
六、安裝 mysql 服務
mysqld -install
七、啟動 mysql 服務
net start mysql
到這裡,mysql服務就啟動好,我們就可以用root進入 mysql
mysql -u root -p
為了方便,最好將mysql配置到環境變量中去
後記:
如果中途有什麼步驟失敗,一定要執行 mysql 移除命令,然後刪除 data 目錄下的所有文件
mysqld -remove
特別提醒:5.7 和 5.6 不太相同,要自己初始化數據 data 目錄,不然啟動不會成功
mysql 安裝完後可能會用到的語句
alter user 'root'@'localhost' identified by '123'; create database victor; create user 'victor'@'localhost' identified by 'victor@123'; flush privileges; creaet user 'victorremote'@'%' identified by 'victorremote@123'; flush privileges; grant all on victor.* to 'victor'@'localhost' identified by 'victor@123'; flush privileges; grant all on victor.* to 'victorremote'@'%' identified by 'victorremote@123'; flush privileges; ################################
show variables like 'collation_%';
show variables like 'character_set_%';
set collation_connection=utf8_general_ci;
set character_set_client=utf8;
set character_set_connection=utf8;
set character_set_results=utf8;
mysql 配置參數查詢
http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持。
[db:作者簡介][db:原文翻譯及解析]