mysql5.7 zip windows下安装

今天安装mysql5.7.10的zip windows版发现不少问题,记录一下

首先下载mysql  http://dev.mysql.com/downloads/mysql/

解压到D:\Program Files\mysql-5.7.10-winx64

并将该目录添加到环境变量path中

在该目录下复制my-default.ini中的内容,新建一个文件my.ini,并将内容粘贴进去。

现在该目录的结构为


修改my.ini的内容如下

# For advice on how to change settingsplease see

#http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

# *** DO NOT EDIT THIS FILE. It's atemplate which will be copied to the

# *** default location during install, andwill be replaced if you

# *** upgrade to a newer version of MySQL.

[mysql]

default-character-set=utf8

[mysqld]

 

# Remove leading # and set to the amount ofRAM for the most important data

# cache in MySQL. Start at 70% of total RAMfor dedicated server, else 10%.

# innodb_buffer_pool_size = 128M

 

# Remove leading # to turn on a veryimportant data integrity option: logging

# changes to the binary log betweenbackups.

# log_bin

 

# These are commonly set, remove the # andset as required.

basedir = D:/Program Files/mysql-5.7.10-winx64

datadir = D:/Program Files/mysql-5.7.10-winx64/data

port = 3306

# server_id = .....

character_set_server=utf8

 

 

# Remove leading # to set options mainlyuseful for reporting servers.

# The server defaults are faster fortransactions and fast SELECTs.

# Adjust sizes as needed, experiment tofind the optimal values.

# join_buffer_size = 128M

# sort_buffer_size = 2M

# read_rnd_buffer_size = 2M

 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[client]

port=3306

default-character-set=utf8

之后打开cmd命令窗口,注意要以管理员的身份运行,

转到D:\Program Files\mysql-5.7.10-winx64目录中执行

mysqld –install

将mysql安装为服务

之后启动服务

net start mysql

发现服务无法启动,在网上查找问题和参考官方文档,http://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html,发现需要手工的创建data文件夹

运行命令

mysqld –initialize

会卡顿一会儿,之后会看到D:\Program Files\mysql-5.7.10-winx64目录中会出现一个data文件夹

接着启动服务

net start mysql

服务成功启动

之后修改mysql的root密码,

执行

mysql –u root

发现无法登陆

查看官方文档

有以下说明

To initialize the data directory, invokemysqld with the --initialize or --initialize-insecure option, depending onwhether you want the server to generate a random initial password for the'root'@'localhost' account.

Regardless of platform, use --initializefor “secure by default” installation (that is, including generation of a randominitial root password). In this case, the password is marked as expired and youwill need to choose a new one. With the --initialize-insecure option, no rootpassword is generated; it is assumed that you will assign a password to theaccount in timely fashion before putting the server into production use.

大概意思是以—initialize创建的data文件夹会为root @ localhost生成一个随机的密码,以--initialize-insecure不会创建密码

笔者使用的是—initialize,继续查看文档

With --initialize but not--initialize-insecure, the server generates a random password, marks it asexpired, and writes a message displaying the password:

 

[Warning] A temporary password is generated for root@localhost:

iTag*AfrH5ej

If you used --initialize but not --initialize-insecure to initializethe data directory, connect to the server as root using the random passwordthat the server generated during the initialization sequence:

 

shell> mysql -u root -p

Enter password: (enter the random rootpassword here)

Look in the server error log if you do not know this password.

 

If you used --initialize-insecure toinitialize the data directory, connect to the server as root without apassword:

 

shell> mysql -u root --skip-password

大概意思是说以—initialize方式创建data时要以mysql -u root –p命令登陆,并且密码不知道的话会在错误日志中,

回到D:\Program Files\mysql-5.7.10-winx64中,进入data文件夹,看到一个以当前的计算机名为名字,以.err为后缀的文件,打开,如下图


在第8行发现了临时随机生成的密码,47rhFKYdyC/k

执行命令mysql -u root –p

输入密码47rhFKYdyC/k

成功登陆

运行语句

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

更改root密码。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
校园悬赏任务平台对字典管理、论坛管理、任务资讯任务资讯公告管理、接取用户管理、任务管理、任务咨询管理、任务收藏管理、任务评价管理、任务订单管理、发布用户管理、管理员管理等进行集中化处理。经过前面自己查阅的网络知识,加上自己在学校课堂上学习的知识,决定开发系统选择小程序模式这种高效率的模式完成系统功能开发。这种模式让操作员基于浏览器的方式进行网站访问,采用的主流的Java语言这种面向对象的语言进行校园悬赏任务平台程序的开发,在数据库的选择上面,选择功能强大的Mysql数据库进行数据的存放操作。校园悬赏任务平台的开发让用户查看任务信息变得容易,让管理员高效管理任务信息。 校园悬赏任务平台具有管理员角色,用户角色,这几个操作权限。 校园悬赏任务平台针对管理员设置的功能有:添加并管理各种类型信息,管理用户账户信息,管理任务信息,管理任务资讯公告信息等内容。 校园悬赏任务平台针对用户设置的功能有:查看并修改个人信息,查看任务信息,查看任务资讯公告信息等内容。 系统登录功能是程序必不可少的功能,在登录页面必填的数据有两项,一项就是账号,另一项数据就是密码,当管理员正确填写并提交这二者数据之后,管理员就可以进入系统后台功能操作区。项目管理页面提供的功能操作有:查看任务,删除任务操作,新增任务操作,修改任务操作。任务资讯公告信息管理页面提供的功能操作有:新增任务资讯公告,修改任务资讯公告,删除任务资讯公告操作。任务资讯公告类型管理页面显示所有任务资讯公告类型,在此页面既可以让管理员添加新的任务资讯公告信息类型,也能对已有的任务资讯公告类型信息执行编辑更新,失效的任务资讯公告类型信息也能让管理员快速删除。
要在Windows安装MySQL 5.7,你可以按照以下步骤进行操作: 1. 首先,你需要下载MySQL 5.7的安装程序。你可以从MySQL官方网站的下载页面上找到适合你系统的安装程序。 2. 下载完成后,双击运行安装程序并按照提示进行安装。在安装过程中,你可以选择自定义安装选项,如选择安装目录、设置密码等。 3. 在安装过程中,你需要选择启动类型。选择“典型”启动类型是最常见的选择,它会将MySQL作为一个Windows服务后台运行。 4. 完成安装后,你可以使用MySQL的命令行工具或者可视化界面工具来管理和操作MySQL数据库。 注意:在安装过程中,请确保你已经按照安装程序的要求提供了正确的配置信息,并且选择了适当的安装选项。另外,如果你已经安装了之前的MySQL版本,请确保卸载旧版本并删除相关的文件和文件夹,以避免冲突。 总结起来,安装MySQL 5.7在Windows上可以通过下载安装程序、运行安装程序、根据提示进行安装和配置,然后使用命令行工具或者可视化界面工具进行管理和操作。<span class="em">1</span> #### 引用[.reference_title] - *1* [mysql5.7 windows bat脚本一键安装.zip](https://download.csdn.net/download/lqz1104874504/19790921)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值