1.解压mysql-5.6.24-winx64.1432007928.zip,得到一个mysql-5.6.24-winx64文件夹,我的放到D盘下;
2.设置相关的配置信息(在D:\mysql-5.6.24-winx64下新建一个my.ini文件内容):
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:\mysql-5.6.24-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\mysql-5.6.24-winx64\data
# 允许最大连接数
max_connections=20
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
#注:在启动服务时,有时报1067,我把这个文件又改名,就正常了。
3.安装并设置密码,打开CMD
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\lzh>d:
D:\>cd mysql-5.6.24-winx64
D:\mysql-5.6.24-winx64>cd bin
D:\mysql-5.6.24-winx64\bin>mysqld --remove
Service successfully removed.
D:\mysql-5.6.24-winx64\bin>mysqld -install
Service successfully installed.
D:\mysql-5.6.24-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
D:\mysql-5.6.24-winx64\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.24 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.01 sec)
mysql> use mysql;
Database changed
mysql> update user set password=PASSWORD("root1234") 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
D:\mysql-5.6.24-winx64\bin>