mybatis框架——实战练习——mysql8安装——mysql-8.0.29——用户名:root--密码:123456--数据库名:mysql8...

本文档详细介绍了如何在Windows上安装MySQL8,包括下载、解压、配置my.ini文件、初始化数据库、设置root密码以及启动服务。过程中提到了可能出现的错误及解决方法,如初始密码的获取和使用。此外,还提及了使用Navicat进行数据库连接,并展示了如何修改root用户的初始密码。
摘要由CSDN通过智能技术生成

下载网址:https://dev.mysql.com/downloads/mysql/

在C盘建立文件夹mysql8,并发下载的压缩文件放进去,并解压:

新建my.ini配置文件,并输入如下内容:

[client]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
# 设置3306端口
port = 3306

# 设置mysql的安装目录
basedir=C:\\Program Files\\mysql8\\mysql-8.0.29-winx64\\mysql-8.0.29-winx64

# 设置 mysql数据库的数据的存放目录,MySQL 8+ 不需要以下配置,系统自己生成即可,否则有可能报错
# datadir=C:\\Program Files\\mysql8

# 允许最大连接数
max_connections=20

# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8

# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

以管理员身份运行cmd.exe

执行如下命令:

切换到安装目录:

cd C:\Program Files\mysql8\mysql-8.0.29-winx64\mysql-8.0.29-winx64\bin

初始化数据库;

mysqld --initialize --console

执行完成后,会打印root的初始密码: =aEB%&xdS4zo

输入以下安装命令:

mysqld install

启动输入以下命令即可:

net start mysql
C:\Windows\system32>cd C:\Program Files\mysql8\mysql-8.0.29-winx64\mysql-8.0.29-winx64\bin

C:\Program Files\mysql8\mysql-8.0.29-winx64\mysql-8.0.29-winx64\bin>mysqld --initialize --console
2022-05-21T05:08:32.502395Z 0 [System] [MY-013169] [Server] C:\Program Files\mysql8\mysql-8.0.29-winx64\mysql-8.0.29-winx64\bin\mysqld.exe (mysqld 8.0.29) initializing of server in progress as process 19696
2022-05-21T05:08:32.503495Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2022-05-21T05:08:32.521934Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-05-21T05:08:32.987543Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-05-21T05:08:33.877566Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: =aEB%&xdS4zo

C:\Program Files\mysql8\mysql-8.0.29-winx64\mysql-8.0.29-winx64\bin>mysqld install
Service successfully installed.

C:\Program Files\mysql8\mysql-8.0.29-winx64\mysql-8.0.29-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。


C:\Program Files\mysql8\mysql-8.0.29-winx64\mysql-8.0.29-winx64\bin>mysql -u root -p
Enter password: ******
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

C:\Program Files\mysql8\mysql-8.0.29-winx64\mysql-8.0.29-winx64\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.29

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> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> show database;

=========================================================================

下载Navicat;目前有14天免费试用期

设置连接名:myslq8;

用户名:   root

密码:   =aEB%&xdS4zo

创建一个新数据库,名为mysql8

参考网址:

https://blog.csdn.net/Dyoungwhite/article/details/122426288

https://www.runoob.com/mysql/mysql-install.html

修改新密码:  123456

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值