《MysqL必读MysqL 5.7.11 zip安装配置方法图文教程》要点:
本文介绍了MysqL必读MysqL 5.7.11 zip安装配置方法图文教程,希望对您有用。如果有疑问,可以联系我们。
一、下载MysqL 5.7.11 zip 安装包 MysqL应用
本机以win7 64位系统为例,如果是32位系统,请下载32位的安装包MysqL应用
http://dev.MysqL.com/downloads/MysqL/MysqL应用
选择 Windows (x86,64-bit),ZIP Archive 下载包MysqL应用
二、解压安装包 | Extracting the Install ArchiveMysqL应用
D:\victor.min\software\MysqL-5.7.11-winx64 #我的解压目录
三、创建一个空文件夹,命名为data, 也可以随便命名,用来存放数据MysqL应用
# 本机创建在 D:\victor.min\software\MysqL-5.7.11-winx64 目录下,所以最后会看到 D:\victor.min\software\MysqL-5.7.11-winx64\data #此文件夹后面会有用到
四、配置一个自己的启动配置文件 | Creating an Option FileMysqL应用
如果自己用没什么特别的,就把 D:\victor.min\software\MysqL-5.7.11-winx64\my-default.ini 文件copy一份,重新命名为 my.ini,修改里面的几个参数就好了 || 配置文件如下MysqL应用
# 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 DirectoryMysqL应用
当然,按照MysqL官方文档给出的步骤还有一步 Selecting a MysqL Server Type,就是选择用 MysqLd 还是 MysqLd-debug |命令如下MysqL应用
注:MysqL应用
1、这个命令很重要,它会初始化 data 目录,在执行此命令前请先把data目录下的所有文件先删除,否则会失败MysqL应用
2、可以选择用 --initialize-insecure 或者 --initialize 来初始化,--initialize-insecure 初始化root密码为空,如果用 --initialize来初始化,会产生一个随机密码MysqL应用
执行成功后你会在data目录 下看到 MysqL,perofrmance_schema,sys目录,同时还会有一些文件MysqL应用
MysqLd -install
net start MysqL
到这里,MysqL服务就启动好,我们就可以用root进入 MysqLMysqL应用
MysqL -u root -p
为了方便,最好将MysqL配置到环境变量中去 MysqL应用
后记:MysqL应用
如果中途有什么步骤失败,一定要执行 MysqL 移除命令,然后删除 data 目录下的所有文件MysqL应用
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;
http://dev.MysqL.com/doc/refman/5.7/en/server-system-variables.htmlMysqL应用