window系统安装mysql8.0完整版

window系统安装mysql8.0完整版
!!!!本人修改了mysql的端口号3308,可以自己修改my.ini文件中的配置

一、下载两个版本的MySQL
进入官网下载:https://www.mysql.com/
在这里插入图片描述
在这里插入图片描述

二、将下载下来的压缩包放到合适的位置并且解压缩
注意:此处先解压安装MySQL8时再解压8.0版本(要不然容易出问题)

配置环境变量

在这里插入图片描述
在这里插入图片描述

 安装MySQL8

  1、先创建my.ini文件

复制代码
# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory 
# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
# make sure the server reads the config file use the startup option 
# "--defaults-file". 
#
# To run run the server from the command line, execute this in a 
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# To install the server as a Windows service manually, execute this in a 
	# command line shell, e.g.
# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server 	X.Y\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQLXY
#
#
# Guildlines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
#
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]

port=3308

[mysql]

default-character-set=utf8


# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3308


#Path to installation directory. All paths are usually resolved relative to this.
basedir="D:/workmenus/MySQL8/MySQL8/mysql-8.0.19-winx64"

#Path to the database root
datadir="D:/workmenus/MySQL8/MySQL8/mysql-8.0.19-winx64/Data/"
# 允许最大连接数
max_connections=10000
# 允许最大连接人数
max_user_connections=1000
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

# 连接时间
wait_timeout=31536000
interactive_timeout=31536000

复制代码
2、生成data文件夹
   以管理员身份打开cmd命令提示符,切换到MySQL8的 bin 路径下。
   输入命令:mysqld --initialize
   等一段时间,它会重新生成一个 Data 文件夹
   同样找到.err文件,找到对应生成的随机密码
   在这里插入图片描述

3、安装MySQL8服务
在命令行输入 (名字命名为MYSQL8,并且指定默认的配置文件为刚才创建 的my.ini文件)

mysqld --install MYSQL8 --defaults-file=D:\workmenus\MySQL8\MySQL8\mysql-	8.0.19-winx64\my.ini

4、开启MySQL8服务

  在命令行输入
  net start MYSQL8

在这里插入图片描述

5、登录MYSQL8,并且修改密码

(1)登录输入:mysql -u root -P 3308 -h localhost -p
密码输入 .err文件里的生成的随机密码

(2)修改密码输入:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

6、链接成功
在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值