mysql安装 8.0.25 zip

本文详细记录了一位用户在Windows上安装MySQL8.0.25的过程,包括下载、解压、初始化、安装服务、启动服务以及修改root用户密码的步骤。在过程中遇到了数据目录已存在、编码问题及权限问题等常见错误,并给出了解决方案。
摘要由CSDN通过智能技术生成

好气啊,我用msi包安装了十几遍都没成功!!!!最终解决了 哎。。。心累

1.下载MySQL链接

https://dev.mysql.com/downloads/mysql/

2.解压zip 

        自己找个位置,解压完大致长这样(可别下载debug版本啊,哎。。。心累,我感觉把所有的坑踩了一遍

 

4.初始化Mysql

创建文件(ACSI编码)  重点!!!!!!! 见下图

先新建一个文件,一般都是新建一个txt嘛, 编辑下面这段配置。之后另存为  my.ini, 还得配置编码我跟你讲!!!!

下面这个配置信息  basedir    datadir 这个换成自己的 `D:\soft\mysql-8.0.25-winx64`

\Data 别动  注意:Data文件夹不要手动创建,让他自动生成

my.ini文件代码如下:别抄我的 自己看着改改 主要是路径,如果一会报错了,试试将这两个地方的单\ 都改为\\ ,例如: 

`basedir=D:\\soft\mysql-8.0.25-winx64

datadir=D:\\soft\mysql-8.0.25-winx64\\Data`

[mysqld]
port=3306
basedir=D:\soft\mysql-8.0.25-winx64
datadir=D:\soft\mysql-8.0.25-winx64\Data
max_connections=200
max_connect_errors=10
character-set-server=utf8mb4
default-storage-engine=INNODB
default_authentication_plugin=mysql_native_password
[mysql]
default-character-set=utf8mb4
[client]
port=3306
default-character-set=utf8mb4

文件另存为,改一下编码,保存!!!!!

5.以管理员身份打开命令行

你可能跟我一样直接在文件夹里来个 cmd 打开的,不得行!!!!!

 切换到自己的mysql安装目录bin下

6.执行命令

mysqld --initialize --console

7.记住临时密码{注意,要等他执行完命令后自动退出}

最后就是 初始化密码  :  root@localhost: ZPv(aI(AU3<9

D:\software\mysql-8.0.25-winx64\bin>mysqld --initialize --console
2021-07-12T15:24:17.885560Z 0 [System] [MY-013169] [Server] D:\software\mysql-8.0.25-winx64\bin\mysqld.exe (mysqld 8.0.25) initializing of server in progress as process 10764
2021-07-12T15:24:17.889129Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2021-07-12T15:24:17.889149Z 0 [ERROR] [MY-013236] [Server] The designated data directory D:\software\mysql-8.0.25-winx64\Data\ is unusable. You can remove all files that the server added to it.
2021-07-12T15:24:17.907061Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-07-12T15:24:17.911325Z 0 [System] [MY-010910] [Server] D:\software\mysql-8.0.25-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.25)  MySQL Community Server - GPL.

D:\software\mysql-8.0.25-winx64\bin>mysqld --initialize --console
2021-07-12T15:24:46.992290Z 0 [System] [MY-013169] [Server] D:\software\mysql-8.0.25-winx64\bin\mysqld.exe (mysqld 8.0.25) initializing of server in progress as process 3124
2021-07-12T15:24:47.010950Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-07-12T15:24:48.354787Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-07-12T15:24:51.641087Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: ZPv(aI(AU3<9

8.安装mysql服务

执行:mysqld --install

 

9.启动Mysql服务

还是在bin下执行:

net start mysql

`D:\software\mysql-8.0.25-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

`启动成功

10.修改密码

执行:mysql -u root -p

再输入刚刚保存的临时密码

如图出现出现(mysql> )字样代表成功

再执行(注意下面的语句是不是英文输入法的单引号)

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

密码就改成 admin了 

刷新权限,使新密码生效

flush privileges;

再次登录出现mysql即成功

最后附下my.ini 弄好之后的操作:

cd bin

D:\software\mysql-8.0.25-winx64\bin>mysqld --initialize --console
2021-07-12T15:24:17.885560Z 0 [System] [MY-013169] [Server] D:\software\mysql-8.0.25-winx64\bin\mysqld.exe (mysqld 8.0.25) initializing of server in progress as process 10764
2021-07-12T15:24:17.889129Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2021-07-12T15:24:17.889149Z 0 [ERROR] [MY-013236] [Server] The designated data directory D:\software\mysql-8.0.25-winx64\Data\ is unusable. You can remove all files that the server added to it.
2021-07-12T15:24:17.907061Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-07-12T15:24:17.911325Z 0 [System] [MY-010910] [Server] D:\software\mysql-8.0.25-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.25)  MySQL Community Server - GPL.

D:\software\mysql-8.0.25-winx64\bin>mysqld --initialize --console
2021-07-12T15:24:46.992290Z 0 [System] [MY-013169] [Server] D:\software\mysql-8.0.25-winx64\bin\mysqld.exe (mysqld 8.0.25) initializing of server in progress as process 3124
2021-07-12T15:24:47.010950Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-07-12T15:24:48.354787Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-07-12T15:24:51.641087Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: ZPv(aI(AU3<9

D:\software\mysql-8.0.25-winx64\bin>mysqld --install
Service successfully installed.

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


D:\software\mysql-8.0.25-winx64\bin>mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

D:\software\mysql-8.0.25-winx64\bin>mysql -u root -p
Enter password: ************
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

D:\software\mysql-8.0.25-winx64\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.25

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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.

然后自己改密码!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值