Windows中 MySQL5.7.17解压版安装步骤
1、先去MySQL官网下载。当前最新版是5.7.19,可能安装方法不同了,本人测试没有安装成功,若有安装成功的朋友,希望分享一下安装步骤。
个人推荐下载MySQL5.7.17,官方下载网址:https://downloads.mysql.com/archives/community/,然后选择5.7.17然后下载即可。
2、将下载的压缩包解压出来,然后在“MySQL解压目录”中新建“data”文件夹。如下图:
3、将“my-default.ini”复制一份,并改名为:“my.ini”(如上图中的my.ini),修改“basedir”指向“MySQL解压目录”,“datadir”指向MySQL解压目录下的“data”(data为第二步自己创建的)。 my.ini内容如下:
# 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 = .....
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir = E:\Java\MySQL\mysql-5.7.17-winx64
# 设置mysql数据库的数据的存放目录
datadir = E:\Java\MySQL\mysql-5.7.17-winx64\data
# 允许最大连接数
max_connections = 200
# 服务端使用的字符集默认为8比特编码的latin1字符集
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、为了方便,配置一下环境变量。
4.1、新增系统变量: MYSQL_HOME : 你的MySQL解压目录
4.2、配置Path环境变量:在Path中添加:%MYSQL_HOME%\bin
5、准备工作已完成,接下来就开始真正的安装了:
1、以管理员启动命令行,注意以”管理员“形式启动。
2、输入命令:mysqld --initialize-insecure
该命令是初始化数据库得到data目录,执行完之后你会发现data中生成了一些文件。
3、接着执行命令:mysqld --install 若出现 Service successfully installed.则说明安装成功!
4、执行命令:net start mysql 启动MySQL服务,出现如下如说明服务已经成功启动
5、跟换MySQL root用户密码:
5.1 登录MySQL: mysql -uroot -p,首先是没有密码的
5.2 修改密码:set password for root@localhost = password('123456');
到这里就算全部安装完成。。。。。希望此文章可以对你有帮助。。。。。