Windows下MySQL 5.6 免安装配置步骤

1.首先下载MySQL 5.6 免安装版

我用的版本:链接:https://pan.baidu.com/s/1vZ2EcadTq4Z–xhJF2mOtg 密码:6g1x
如果需要其他版本的,可以自行到官网下载。

2.解压MySQL压缩包

将MySQL压缩包解压到自己指定的位置。
我的位置为:D:\DevelopmentTools\mysql-5.6.19-winx64

3.配置环境变量

在Windows环境变量中配置path,在path后面增加MySQL的bin目录,例如:
;D:\DevelopmentTools\mysql-5.6.19-winx64\bin;
注意用分号“;”隔开

4.新建my.ini文件

在MySQL目录下,新建一个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.

[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 = D:\\DevelopmentTools\\mysql-5.6.19-winx64
 datadir = D:\\DevelopmentTools\\mysql-5.6.19-winx64\\data
 port = 3306
# 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 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
5.使用管理员身份打开cmd窗口并切换至MySQL\bin目录

进入MySQL的bin目录下,安装mysql

C:\Users\echo>D:
D:\>cd Dev\mysql-5.6.19-winx64\bin
D:\Dev\mysql-5.6.19-winx64\bin>mysqld –install // 安装mysql
6.启动MySQL服务
net start mysql
7.初始化MySQL数据库
mysqld --initialize-insecure --user=mysql;
8.重启MySQL服务,重新打开一个cmd窗口
9.登录

密码可为空,第一次登录,密码是空就行了

mysql -u root -p
10.更改密码
update mysql.user set password=PASSWORD('123456') where User='root';
flush privileges
11.开始使用吧~~

猜你喜欢

转载自blog.csdn.net/qq_26710805/article/details/80171767