win10安装免安装版的mysql5.7

23 篇文章 0 订阅
8 篇文章 0 订阅

win10安装免安装版的mysql5.7

本文讲解的是win10下配置并安装免安装版的mysql5.7

准备

  • win10 64位
  • 安装包mysql-5.7.29-winx64

解压缩

我这里将压缩包,解压缩我的D盘;解压后完整的路径为:D:\MyDeveloper\mysql-5.7.29-winx64

新建文件夹:data

新建一个文件:my.ini

  • 当前目录的结构如下:
├── mysql-5.7.29-winx64
│   ├── bin
│   ├── data
│   ├── docs
│   ├── include
│   ├── lib
│   ├── LICENSE
│   ├── my.ini
│   ├── README
│   └── share

配置my.ini

配置my.ini文件,内容如下:

[mysqld]
basedir ="D:\MyDeveloper\mysql-5.7.29-winx64"
datadir ="D:\MyDeveloper\mysql-5.7.29-winx64\data"
port=3306
server_id=10
character-set-server=utf8
character_set_filesystem=utf8
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
[client]
port=3306
default-character-set=utf8
[mysqld_safe]
timezone="CST"
[mysql]
default-character-set=utf8

安装

配置环境变量

环境变量的Path中,新建一个,将mysql的bin目录加进去,如下图:

在这里插入图片描述

执行安装

以管理员的方式运行powershell

依次执行:mysqld --install

mysqld --inlstall

提示安装成功即可。

执行:mysqld --initialize-insecure --user=mysql

mysqld --initialize-insecure --user=mysql

没有输出表示安装成功

启动服务

执行: net start mysql 启动mysql的服务,输出的内容如下:

PS C:\Windows\system32> net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

配置root密码

登录

使用: mysql -u root -p 进行登录,输入完成后敲回车;提示你输入密码,不用管,直接再次回车即可;输入的内容如下:

PS C:\Windows\system32> 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.29 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, 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.

设置密码

  • 登录成功后,切换数据库:use mysql
mysql> use mysql
Database changed
  • 更新数据库密码:update user set authentication_string=password(‘root’) where user=‘root’;
mysql> update user set authentication_string=password('root') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1
  • 退出:quit
mysql> quit
Bye
  • 重新启动,依次执行:net stop mysql 和net start mysql
PS C:\Windows\system32> net stop mysql
MySQL 服务正在停止.
MySQL 服务已成功停止。

PS C:\Windows\system32> net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
  • 再次登录,这个时候需要输入密码了,如下:
PS C:\Windows\system32> 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.29 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, 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.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Jack_David

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值