欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

mysql-8.0.18-winx64的zip安装

程序员文章站 2024-03-21 17:44:58
...

1官网下载zip文件,并解压到指定目录https://dev.mysql.com/downloads/mysql/

(mysql-8.0.18-winx64.zip)

2官网安装教程https://dev.mysql.com/doc/refman/8.0/en/windows-create-option-file.html

3在mysql解压目录下新建一个配置文件my.ini

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:\work\mysql-8.0.18-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\work\mysql-8.0.18-winx64\data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。
max_connect_errors=10
# 服务端使用的字符集默认为utf8mb4
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8mb4
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

 以系统管理员身份,启动,开始时老是报错启动异常,莫名又ok了,此时初始化完成后,就生成了一个随机密码

PS D:\work\mysql-8.0.18-winx64\bin> mysqld --initialize --console
2019-12-06T03:19:04.768001Z 0 [System] [MY-013169] [Server] D:\work\mysql-8.0.18-winx64\bin\mysqld.exe (mysqld 8.0.18) initializing of server in progress as process 17544
2019-12-06T03:19:06.637812Z 5 [Note] [MY-010454] [Server] A temporary password is generated for aaa@qq.com: wybAuNOyd8;c

安装mysql服务

PS D:\work\mysql-8.0.18-winx64\bin> mysqld --install
The service already exists!
The current server installed: D:\work\mysql-8.0.18-winx64\bin\mysqld.exe MySQL

服务已经存在可执行删除 sc delete msyql 再执行安装

启动服务,并利用上面生成的随机密码登录服务,并修改root账户密码为root

PS D:\work\mysql-8.0.18-winx64\bin> net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

PS D:\work\mysql-8.0.18-winx64\bin> mysql -uroot -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.18

Copyright (c) 2000, 2019, 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.02 sec)

5 将mysql服务添加到系统环境变量中 path中

mysql-8.0.18-winx64的zip安装

 

在计算机管理中查看msyql服务是否为自动开启

mysql-8.0.18-winx64的zip安装