1、

2、添加环境变量:
MYSQL_HOME:

PATH里面添加环境变量:

3、在MySql解压目录(根目录)新建文件my.ini

修改里面的内容为:
[client]
port=3306
#设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
# Remove leading # and set to the amount ofRAM for the most important data
# cache in MySQL. Start at 70% of total RAMfor dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a veryimportant data integrity option: logging
# changes to the binary log betweenbackups.
# log_bin
# These are commonly set, remove the # andset as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
#端口
port=3306
#服务端使用的字符集默认为8比特编码的latin1字符集
character_set_server=utf8
#安装目录--这里还是用全路径吧,用相对路径老是出错~
basedir= E:\\Work\\AndroidTools\\mysql-5.7.17-winx64
# 这里还是用全路径吧,用相对路径老是出错~
datadir= E:\\Work\\AndroidTools\\mysql-5.7.17-winx64\\data
# Remove leading # to set options mainlyuseful for reporting servers.
# The server defaults are faster fortransactions and fast SELECTs.
# Adjust sizes as needed, experiment tofind the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[WinMySQLAdmin]
%MYSQL_HOME%\bin\mysqld.exe
4、将MySQL注册为Windows的系统服务:
4.1、管理员运行命令行窗口,进入到下面的目录

4.2、输入命令:
mysqld.exe –install
得到如下结果:

重要:
因为MySql5.7目录下没有data文件夹,所以需要创建
在输入下面的命令,创建data文件夹并产生必要的文件:
mysqld --initialize-insecure --user=mysql;
data文件夹里产生的结果如下:

4.3、注:移除服务的命令为:此项需要的时候在使用。
mysqld –remove
得到如下结果:

5、启动MySQL服务:
5.1、命令行方式启动:
net start mysql
得到如下结果:

5.2、服务里面启动:
Win+R调出运行,输入services.msc,找到MySQL,启动即可
6、修改root用户的密码(我设置的123456):
mysql –u root
show databases;
use mysql;
set password for root@localhost = password('new password');
此时可以使用MySQL了
7、安装客户端(收费,可以用破解版):https://www.navicat.com/download/navicat-premium
7.1、还是直接用破解版吧….(有需要的找我要)
7.3、

7.4、

7.5、此时客户端和Server端均已安装成功且可以使用了
网友评论