mysql6.3.9600_Mysql 安装 - zh151832的个人空间 - OSCHINA - 中文开源技术交流社区

Centos 安装MySQL可以参考之前写的一篇文章 Centos7.3 安装Mysql5.7并修改初始密码

windows安装mysql5.7有两种方式 1、下载.msi安装文件直接根据界面提示进行安装 2、下载.biz压缩包

这里接介绍的是第二种压缩版的安装方式

官方的参考文档 https://dev.mysql.com/doc/refman/5.7/en/windows-install-archive.html

1、下载mysql

c0aaf7e35a8dacd0361b8b4618ec478b.png

caa4a20d7686ba964d54394df351fb9d.png

5cc06822ee12acb3f05b77605fc53594.png

2、安装mysql 压缩包相当于免安装文件,要想使用它只需要配置相关的参数,再通过通过服务来启动数据库服务就可以了。

2、1 把压缩包解压到你喜欢的位置 本示例解压到:D:\software\mysql-5.7.18-winx64 文件夹下

2、2 创建my.ini文件 mysql-5.7.18-winx64根目录中创建my.ini文件添加以下内容:

[mysqld]

#set basedir to your installation path

basedir=D:\software\mysql-5.7.18-winx64

#set datadir to the location of your data directory

datadir=D:\software\mysql-5.7.18-winx64\data

port=3306

maxallowedpacket=32M

注意,basedir和datadir是必须要配置的,basedir就是你解压的目录

2、3 配置环境变量

添加一个名叫 MYSQLHOME 的变量。

修改Path变量,在末尾添加 %MYSQLHOME%\bin

2、4 初始化数据库文件

1、 以管理员身份运行cmd,进入mysql的bin目录。

2、 初始化数据库文件

mysqld --initialize

初始化成功后,会在datadir目录下生成一些文件,其中,xxx.err(xxx是你电脑用户的名称)文件里说明了root账户的临时密码。例子:

2017-05-17T10:31:54.235041Z 1 [Note] A temporary password is generated for root@localhost:

2、5 注册mysql服务

mysqld -install MySQL

2、6 启动mysql服务

net start MySQL

3、 修改root密码 使用root账号登录 这里的密码为上面提到的root账号的临时密码Qrh)jdp

mysql -u root -p

Enter password: ****

修改root密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

1 4、安装日志 mysqld --initialize

mysqld --initialize

D:\software\mysql-5.7.18-winx64\bin>

D:\software\mysql-5.7.18-winx64\bin>mysqld -install MySQL

D:\software\mysql-5.7.18-winx64\bin>net start MySQL

MySQL 服务正在启动 ....

MySQL 服务已经启动成功。

D:\software\mysql-5.7.18-winx64\bin>mysql -uroot -p

Enter password: ************

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.7.18

Copyright (c) 2000, 2017, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';

Query OK, 0 rows affected (0.00 sec)

mysql> exit

Bye" data-snippet-id="ext.3b2123f961723a5af28255824deb945e" data-snippet-saved="false" data-codota-status="done">

Microsoft Windows [版本 6.3.9600]

(c) 2013 Microsoft Corporation。保留所有权利。

D:\software\mysql-5.7.18-winx64\bin>mysqld --initialize

D:\software\mysql-5.7.18-winx64\bin>

D:\software\mysql-5.7.18-winx64\bin>mysqld -install MySQL

D:\software\mysql-5.7.18-winx64\bin>net start MySQL

MySQL 服务正在启动 ....

MySQL 服务已经启动成功。

D:\software\mysql-5.7.18-winx64\bin>mysql -uroot -p

Enter password: ************

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.7.18

Copyright (c) 2000, 2017, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';

Query OK, 0 rows affected (0.00 sec)

mysql> exit

Bye

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值