当前位置: 移动技术网 > IT编程>数据库>Mysql > mysql5.7.13.zip安装教程(windows)

mysql5.7.13.zip安装教程(windows)

2017年12月12日  | 移动技术网IT编程  | 我要评论

这是我之前进行mysql免安装版下载与配置的详细过程,先分享给大家。

1. 下载mysql
官方:→downloads→选社区版本mysql community edition(gpl)→点击community(gpl)downloads>>→mysql community server(gpl)→选择自己要下载的版本(我是64位系统选择的是windows (x86, 64-bit), zip archive)→downloads→no thanks, just start my download.

2.配置环境变量

先将下载好的文件解压到你要安装的位置,我解压到了d:\servers\mysql
方案1:新建环境变量,变量名称:mysql(一般大写、也可小写),变量值:d:\servers\mysql,向path中添加%mysql%/bin
方案2:直接向path中添加d:\servers\mysql\bin

3.安装mysql服务

命令行进入mysql的bin目录下
 (注:进入d盘直接输入“d:“,使用“cd 文件夹名”进入某个文件夹 ,“cd..“返回上一目录)
输入service install或者mysqld install 提示安装成功
输入net start mysql 启动mysql服务
使用mysql –u root –p (此命令是root登入,为简写,详细格式自行查找),root默认密码为空,直接回车即可

4.mysql.ini

原文件为mysql-defult.ini
修改其中的basedir=d:/servers/mysql
                datadir=d:/servers/mysql/data
注意:路径之间为“/“,如果直接复制过来没有改会出现”系统错误1067“
系统错误5  使用管理员权限打开命令提示符

5.连接mysql

命令提示符下输入:mysql -uroot -p
root默认密码为空,直接回车即可进入

按照我之前安装5.6的安装方法(mysql免安装版下载与配置)安装5.7的时候出现问题:
mysql服务无法启动,服务没有报任何错误

其实在这学期开始学习mysql的时候,就听老师同学说,登录不了的问题,当时没有在意,也是因为电脑上早就安装了mysql5.6,也就没有在意这个问题。这两天win10系统出问题,重装了win7,安装5.7的时候出现了这个问题。 

之前的版本默认密码为空,具体版本不太清楚,反正5.6密码是空。5.7的安全性提升,在linux安装5.7的时候,安装完成后会生成一个随机性密码,存储在root/.mysql_secret中,如果没有这个文件,去系统日志中查找password,就应该能找到。 

但是windows下就不知道如何解决了,不过最后还是找到了解决方法。 

解决方法:
来自:
然而并不是缺少data文件夹,将my-default.ini文件改名为my.ini,移动到bin/目录下,在bin/下执行命令 mysqld --initialize --user=mysql --console ,这条命令估计是初始化的命令
 然后启动服务 net start mysql 
 命令行显示贴在这 

microsoft windows [版本 6.1.7601]
版权所有 (c) 2009 microsoft corporation。保留所有权利。

c:\windows\system32>cd ..

c:\windows>cd ..

c:\>cd mysql-5.7.13-winx64/boot
系统找不到指定的路径。

c:\>cd mysql-5.7.13-winx64\bin

c:\mysql-5.7.13-winx64\bin>mysqld install
service successfully installed.

c:\mysql-5.7.13-winx64\bin>net start mysql
mysql 服务正在启动 .
mysql 服务无法启动。

服务没有报告任何错误。

请键入 net helpmsg 3534 以获得更多的帮助。


c:\mysql-5.7.13-winx64\bin>net start mysql
mysql 服务正在启动 .
mysql 服务无法启动。

服务没有报告任何错误。

请键入 net helpmsg 3534 以获得更多的帮助。


c:\mysql-5.7.13-winx64\bin>mysqld --initialize --user=mysql --console
2016-06-21t14:07:20.922112z 0 [warning] timestamp with implicit default value is
 deprecated. please use --explicit_defaults_for_timestamp server option (see doc
umentation for more details).
2016-06-21t14:07:22.669315z 0 [warning] innodb: new log files created, lsn=45790

2016-06-21t14:07:23.106116z 0 [warning] innodb: creating foreign key constraint
system tables.
2016-06-21t14:07:23.308916z 0 [warning] no existing uuid has been found, so we a
ssume that this is the first time that this server has been started. generating
a new uuid: 79c8386d-37b9-11e6-9709-74867a6179b7.
2016-06-21t14:07:23.340116z 0 [warning] gtid table is not ready to be used. tabl
e 'mysql.gtid_executed' cannot be opened.
2016-06-21t14:07:23.355716z 1 [note] a temporary password is generated for root@
localhost: rr9.8h74twfr

c:\mysql-5.7.13-winx64\bin>mysql -uroot -prr9.8h74twfr
mysql: [warning] using a password on the command line interface can be insecure.
error 2003 (hy000): can't connect to mysql server on 'localhost' (10061)

c:\mysql-5.7.13-winx64\bin>net start mysql
mysql 服务正在启动 .
mysql 服务已经启动成功。


c:\mysql-5.7.13-winx64\bin>mysql -uroot -prr9.8h74twfr
mysql: [warning] using a password on the command line interface can be insecure.
welcome to the mysql monitor. commands end with ; or \g.
your mysql connection id is 2
server version: 5.7.13

copyright (c) 2000, 2016, 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> set password=password('');
query ok, 0 rows affected, 1 warning (0.00 sec)

mysql> exit
bye

c:\mysql-5.7.13-winx64\bin>mysql -uroot
welcome to the mysql monitor. commands end with ; or \g.
your mysql connection id is 3
server version: 5.7.13 mysql community server (gpl)

copyright (c) 2000, 2016, 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> exit
bye

c:\mysql-5.7.13-winx64\bin>

精彩专题分享:mysql不同版本安装教程 mysql5.7各版本安装教程 mysql5.6各版本安装教程

其它网友的补充:

环境:windows 10某个版本(写本文的最新版本)

目的:安装个mysql服务端,从官方下载的zip压缩版5.7.16,而不是msi版本。

操作过程折腾了,以前安装过多次,不过好像不是真正意义上的从zip安装,而是使用之前通过msi安装过的版本,后面只是注册成系统服务一项。

本次折腾的的操作,主要从官方是下载.zip版本压缩包,选择的是x64版,解压缩到合适的目录里,本文以 c:\program files\mysql\  为例。

step 0. 准备配置文件:复制my-default.ini得到my.ini ,修改其中的basedir, datadir两个参数,示例如下

basedir = c:\program files\mysql
datadir = d:\data\mysql-data

step 1. 安装为windows服务:管理员身份启动cmd,进入mysql/bin/目录,执行如下安装命令:

mysqld --install mysql --defaults-file="c:\program files\mysql\my.ini"
注意:--install 参数必须在前,否则mysqld会认为你要运行mysqld进程,然后启动失败)

setp 2. 初始化数据目录:创建 d:\data\ ,注意不需要创建mysql-data子目录;运行 mysqld --initialize

step 3. 查root用户初始密码:查windows日志-应用程序日志,里面应该有类似如下一条

a temporary password is generated for root@localhost: 5cuimezand>qfor more information....

其中5cuimezand>q即是默认密码,到命令行里修改一下吧,如下一行,将root密码改为000111, 会有交互提示输入旧密码的。

mysqladmin.exe -uroot -p password "000111"

step 4. 启动windows服务:net start mysql. 完工。

addition. 如需要卸载服务,到mysql/bin/目录里执行 mysqld.exe --remove 即可。需要的话删除mysql数据文件目录。

以上就是mysql5.7.13.zip安装配置方法,以及安装过程中遇到的问题解决方法,希望对大家的学习有所帮助。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网