MySQL压缩版安装配置

原创装载请注明出处:http://agilestyle.iteye.com/blog/2299138

1.下载解压MySQL安装包


2.设置MYSQL_HOME和Path环境变量


 

3.拷贝根目录下的my-default.ini为my.ini,添加如下内容,同样需要在根目录下创建一个data文件夹

# 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.
[mysql]
default-character-set=utf8

[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=F:\Program Files\mysql-5.7.12-winx64
datadir=F:\Program Files\mysql-5.7.12-winx64\data
port=3306
max_connections=200
character-set-server=utf8
default-storage-engine=INNODB


# 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 


 

4.管理员权限启动cmd,输入如下命令安装Windows服务

mysqld -install


 

5.初始化MySQL,执行如下命令

mysqld --initialize
net start mysql


 

6.关闭MySQL服务,管理员权限执行如下命令,需要设置修改root密码

mysqld --defaults-file="F:\Program Files\mysql-5.7.12-winx64\my.ini" --console --skip-grant-tables

 

7.新开一个cmd,输入如下命令,密码为空,直接回车

mysql -uroot -p
use mysql;

update user set authentication_string=password("123456") where user="root";

flush privileges;
mysql -uroot -p123456

 

8.最后还需要执行如下命令

alter user 'root'@'localhost' identified by '123456';


 

还可以查看一下存储引擎

show variables like '%storage_engine%';


 

 

 

 

 

猜你喜欢

转载自agilestyle.iteye.com/blog/2299138
今日推荐