# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/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的缓存,可以根据实际情况调整大小,我这里采取默认值
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.
#mysql根目录
#basedir = D:\tools\mysql-5.7.23-winx64
#数据存储目录
#datadir = D:\tools\mysql-5.7.23-winx64\data
#端口号,默认为3306
port = 3302
#服务实例的唯一标识,这个是做集群的时候使用,单例可以不配置
# 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
#配置一下服务端的字符集
character_set_server=utf8
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#配置一下客户端的字符集
[client]
default-character-set=utf8
4 配置环境变量
新增 MYSQL_HOME D:\tools\mysql-5.7.23-winx64
Path下追加 %MYSQL_HOME%\bin
5 在管理员下使用cmd
进入c:\Windows\System32目录下搜索cmd.exe点击右键使用管理员执行
6 执行命令
进入D:\tools\mysql-5.7.23-winx64\bin目录下
执行 mysqld --initialize
7 注册
mysqld --install MySQL57
8 启动
net start MySQL57
9 查看mysql给root分配的随机密码,用于登录
查看文件路径D:\tools\mysql-5.7.23-winx64\data路径下的.err文件如下:
`2018-09-12T05:56:56.481677Z 1 [Note] A temporary password is generated for root@localhost: 9b/hqaO/z9Yy`
10 登录
mysql -u root -P 3302 -p 输入上步骤中密码即可
11 修改密码
alter user `root`@`localhost` identified by '123456';
12 刷新权限
flush privileges;