各位用户为了找寻关于window环境配置Mysql 5.7.21 windowx64.zip免安装版教程详解的资料费劲了很多周折。这里教程网为您整理了关于window环境配置Mysql 5.7.21 windowx64.zip免安装版教程详解的相关资料,仅供查阅,以下为您介绍关于window环境配置Mysql 5.7.21 windowx64.zip免安装版教程详解的详细内容
1.从官网下载mysql-5.7.21-windowx64.zip mysql下载页面
2.解压到合适的位置(E:mysql) 这名字是我改过的
3.配置环境变量,将E:mysqlbin 添加到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:mysqldata
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-
set
-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
"#"
为注释
5.管理员身份运行cmd
切换目录 cd E:mysqlbin
生成mysql服务(就是安装my.ini文件)
? 1 2E:mysqlbin> mysqld -
install
;
Service successfully installed.
生成data目录 E:mysqlbin> mysqld --initialize-insecure --user=mysql
;
这里生成失败的话看下面
? 1 2E:mysqlbin>
cd
../
E:mysql> mysqld --initialize-insecure --user=mysql ;
启动mysql服务
? 1E:mysqlbin> net start mysql;
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
6.登录数据库,修改密码(默认为空)
? 1 2 3 4 5 6 7 8 9 10 11E:mysqlbin> 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 14mysql> 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 3mysql> quit;
E:mysqlbin> 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