服务器之家:专注于服务器技术及软件下载分享
分类导航

Mysql|Sql Server|Oracle|Redis|MongoDB|PostgreSQL|Sqlite|DB2|mariadb|

服务器之家 - 数据库 - Mysql - window环境配置Mysql 5.7.21 windowx64.zip免安装版教程详解

window环境配置Mysql 5.7.21 windowx64.zip免安装版教程详解

2020-08-25 16:20visitor009 Mysql

这篇文章主要介绍了window环境配置Mysql 5.7.21 windowx64.zip免安装版教程详解,需要的朋友可以参考下

1.从官网下载mysql-5.7.21-windowx64.zip mysql下载页面

2.解压到合适的位置(E:\mysql) 这名字是我改过的

3.配置环境变量,将E:\mysql\bin 添加到PATH中

4.在mysql目录下(E:\mysql) 创建 my.ini文件,内容如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[mysql] 
# 设置mysql客户端默认字符集 
default-character-set=utf8 
[mysqld] 
#设置3306端口 
port = 3306 
# 设置mysql的安装目录 
basedir=E:\mysql
# 设置mysql数据库的数据的存放目录 
datadir=E:\mysql\data
# 允许最大连接数 
max_connections=200 
# 服务端使用的字符集默认为8比特编码的latin1字符集 
character-set-server=utf8 
# 创建新表时将使用的默认存储引擎 
default-storage-engine=INNODB 
"#"为注释

5.管理员身份运行cmd

切换目录 cd E:\mysql\bin

生成mysql服务(就是安装my.ini文件)

?
1
2
E:\mysql\bin> mysqld -install;
Service successfully installed.

生成data目录  E:\mysql\bin> mysqld --initialize-insecure --user=mysql ;

这里生成失败的话看下面

?
1
2
E:\mysql\bin>cd ../
E:\mysql> mysqld --initialize-insecure --user=mysql ;

启动mysql服务

?
1
E:\mysql\bin> net start mysql;

MySQL 服务正在启动 . 

MySQL 服务已经启动成功。

6.登录数据库,修改密码(默认为空)

?
1
2
3
4
5
6
7
8
9
10
11
E:\mysql\bin> mysql -u root -p;
Enter password: //这里直接回车
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.21 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, 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>

修改密码

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
mysql> show databases;
+--------------------+
| Database      |
+--------------------+
| information_schema |
| mysql       |
| performance_schema |
| sys        |
+--------------------+
4 rows in set (0.00 sec)
mysql> use mysql;
Database changed
mysql> set password for 'root'@'localhost'=password('新密码');
mysql> flush privileges;

退出测试是否成功

?
1
2
3
mysql> quit;
E:\mysql\bin> mysql -u root -p;
Enter password:

注释:

在mysql中一条语句结束加;号

开始mysql服务net start mysql;
停止mysql服务net stop mysql;
生成服务mysqld -install;
删除服务mysqld -remove;
登录数据库mysql -u root -p;
退出mysql> quit;

总结

以上所述是小编给大家介绍的window环境配置Mysql 5.7.21 windowx64.zip免安装版教程详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

原文链接:https://www.jianshu.com/p/f3dd615c786d

延伸 · 阅读

精彩推荐