1.解压后,在bin文件夹同级目录
在F:\mysql-5.6.28-winx64\mysql
新建一个my.ini文件,my.ini内容如下:
[client]
port=3306
default-character-set=utf8
[mysqld]
# 设置为MYSQL的安装目录
basedir=F:/mysql-5.6.28-winx64/mysql
# 设置为MYSQL的数据目录
datadir=F:/mysql-5.6.28-winx64/mysql/data
port=3306
character_set_server=utf8
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
2)进入cmd,进入到F:\mysql-5.6.28-winx64\mysql\bin
由于之前安装了其他版本的mysql,需要停掉服务,完全卸载
执行删除服务
F:\mysql-5.6.28-winx64\mysql\bin>sc delete mysql
[SC] DeleteService 成功
执行安装服务
F:\mysql-5.6.28-winx64\mysql\bin>mysqld.exe -install
Service successfully installed.
3)启动msyql
net start mysql
我是写了个.bat文件,方便启动
@echo off
cd mysql\bin
net start mysql
4)修改root密码
无密码登录后,进行修改
mysql -uroot -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> use mysql
Database changed
mysql> UPDATE user SET password=PASSWORD("pwd") WHERE user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
F:\mysql-5.6.28-winx64\mysql\bin>
OK~,玩去了