绕过MySQL Installer 安装 MySQL服务

该教程详细介绍了如何在Windows上安装MySQL8.0,包括拒绝捆绑软件,自定义安装路径,初始化数据库,设置默认密码,安装服务,启动服务以及修改root用户密码的过程。在安装过程中,发现my.ini配置文件缺失,并提供了删除与重新安装服务的方法。
摘要由CSDN通过智能技术生成

此教程提供mysql服务安装教学,拒绝捆绑软件并且还是默认安装在c盘下的 mysql installer
mysql msi版本下载地址:https://mirrors.aliyun.com/mysql/

安装

  1. 官网下载mysql,下载完后解压
    在这里插入图片描述

  2. 配置环境变量Path(此步不做)

Path=D:\Programs\mysql-8.0.33-winx64\bin
  1. 管理员身份运行cmd,来到MySQL的bin目录下,运行下列命令
    此处会生成默认密码,复制这个密码,修改密码时要用到

在这里插入图片描述
不用管理员也可

mysqld --initialize --console

管理员:

mysqld --install

在这里插入图片描述

启动mysql服务:

net start mysql

在这里插入图片描述

修改密码

  1. 登录mysql
mysql -u root -p
  1. 修改密码,123456为新密码
ALTER user 'root'@'localhost' IDENTIFIED BY '123456'
  1. 使用修改后的密码登录
mysql -u root -p

登陆成功
在这里插入图片描述

此方法也适用于msi版本的安装,msi版本可以在搜狐镜像站找到:https://mirrors.sohu.com/mysql/
阿里云镜像:https://mirrors.aliyun.com/mysql/

问题:mysql 8.0在安装后找不到my.ini,%programdata%里都没有mysql/mysql 8.0的文件夹
mysql 5.7 安装后在%programdata%里有mysql/mysql 5.7这个文件夹,但是里面没有my.ini

删除服务:sc delete 服务名
mysql安装指定服务名以及mysql的配置文件

mysql5.7安装

Microsoft Windows [版本 10.0.19045.3570]
(c) Microsoft Corporation。保留所有权利。

C:\Windows\system32>mysqld --initialize --console
2023-11-14T08:46:24.148356Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-11-14T08:46:24.358445Z 0 [Warning] InnoDB: New log files created, LSN=45790
2023-11-14T08:46:24.392164Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2023-11-14T08:46:24.471087Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 4ac748c7-82ca-11ee-ae44-000c296dd905.
2023-11-14T08:46:24.474917Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2023-11-14T08:46:25.227271Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2023-11-14T08:46:25.227902Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2023-11-14T08:46:25.228976Z 0 [Warning] CA certificate ca.pem is self signed.
2023-11-14T08:46:26.016500Z 1 [Note] A temporary password is generated for root@localhost: uvmL7V2AXU.G

C:\Windows\system32>mysqld --install
Service successfully installed.

C:\Windows\system32>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。


C:\Windows\system32>mysql -uroot -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.38

Copyright (c) 2000, 2022, 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.

mysql>

如果密码错误就把mysql卸载干净,再重新来一遍

sc delete mysql

mysqld --remove 服务名

怎么进入D盘
在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值