win10 安装运行msyql
- 解压压缩包,到指定的文件夹,查看文件目录如下:
Mysql-5.6.37
├── bin
├── COPYING
├── data
├── docs
├── include
├── lib
├── my-default.ini # 修改配置文件
├── mysql-test
├── README
├── scripts
├── share
└── sql-bench
- 编辑
my-default.ini
文件,重命名文件my.ini
# 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.
[mysql]
no-auto-rehash
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 = 2G
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
log_bin = D:\Develop\Mysql-5.6.37\data\mysql-bin
log_error = error.log
# These are commonly set, remove the # and set as required.
basedir = D:\Develop\Mysql-5.6.37
datadir = D:\Develop\Mysql-5.6.37\data
port = 3306
# server_id = .....
character-set-server = utf8
bind_address = 0.0.0.0
default-storage-engine = INNODB
# 最大连接数
max_connections = 3000
# 最大错误连接数阈值,超过这个数的连接失败就会被拒绝报错。
max_connect_errors = 10000
# 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 = 32M
read_rnd_buffer_size = 32M
#开启mysql binlog功能
log-bin = mysqlbin
binlog_cache_size = 4M
max_binlog_cache_size = 8M
max_binlog_size = 1024M
binlog_format = MIXED
expire_logs_days = 7
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
- 安装服务,cmd管理员身份运行方式
# cmd 到mysql目录
D:\Develop\Mysql-5.6.37\bin>mysqld install
Service successfully installed.
# 启动mysql服务
D:\Develop\Mysql-5.6.37\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
# 进入mysql命令,此时的密码是没有的直接回车键登陆进入即可
D:\Develop\Mysql-5.6.37\bin> mysql -u root -p
# 设置root密码
mysql> use mysql
Database changed
# 第一种方式
mysql> update mysql.user set password=password("123456") where user="root";
# 第二种方式
mysql> set password for root@localhost = password('123456');
# 刷新mysql系统权限
mysql> flush privileges;
# quit退出
mysql> quit;
- 卸载服务,cmd管理员身份运行方式
# 停止msyql
D:\Develop\Mysql-5.6.37\bin>net stop mysql
# 移出服务
D:\Develop\Mysql-5.6.37\bin>mysqld remove
参考文档: