一、下載mysql 5.7.11 zip 安裝包
本機以win7 64位系統(tǒng)為例,如果是32位系統(tǒng),請下載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 #我的解壓目錄
三、創(chuàng)建一個空文件夾,命名為data, 也可以隨便命名,用來存放數(shù)據(jù)
# 本機創(chuàng)建在 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 ,修改里面的幾個參數(shù)就好了 || 配置文件如下
# 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 為用來存放數(shù)據(jù)的目錄
# datadir=./../data
datadir=D:\\victor.min\\software\\mysql-5.7.11-winx64\\data
# port 為端口號
port=3306
# mar_connections為最大連接數(shù)
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
五、初始化數(shù)據(jù)目錄 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 目錄,在執(zhí)行此命令前請先把data目錄下的所有文件先刪除,否則會失敗
2、可以選擇用 --initialize-insecure 或者 --initialize 來初始化,--initialize-insecure 初始化root密碼為空,如果用 --initialize來初始化,會產(chǎn)生一個隨機密碼
執(zhí)行成功后你會在data目錄 下看到 mysql,perofrmance_schema,sys目錄,同時還會有一些文件
六、安裝 mysql 服務(wù)
七、啟動 mysql 服務(wù)
到這里,mysql服務(wù)就啟動好,我們就可以用root進入 mysql
為了方便,最好將mysql配置到環(huán)境變量中去
后記:
如果中途有什么步驟失敗,一定要執(zhí)行 mysql 移除命令,然后刪除 data 目錄下的所有文件
特別提醒:5.7 和 5.6 不太相同,要自己初始化數(shù)據(jù) 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 配置參數(shù)查詢
http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:- mysql 5.7.11 winx64.zip安裝配置方法圖文教程
- Mysql5.7.11綠色版安裝教程圖文詳解
- mysql 5.7.11 winx64安裝配置教程
- Mysql5.7.11在windows10上的安裝與配置(解壓版)
- mysql 5.7.11 winx64安裝配置方法圖文教程
- mysql 5.7.11 winx64快速安裝配置教程
- mysql 5.7.11 安裝配置教程
- mysql 5.7.11 winx64安裝配置方法圖文教程
- MySql5.7.11編譯安裝及修改root密碼的方法小結(jié)
- Mac 安裝和卸載 Mysql5.7.11 的方法