MySQL解压版安装教程
Posted vicoSong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL解压版安装教程相关的知识,希望对你有一定的参考价值。
1.下载
1.1 下载地址
mysql下载地址:https://downloads.mysql.com/archives/community/
2.设置配置文件
2.1 新建my.ini文件设置文件内容如下
[mysqld]
#设置时区为东八区,此项设置后,在连接MySQL的时候可以不用每次都手动设置时区
default-time-zone = \'+8:00\'
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:\\app\\mysql8
# 设置mysql数据库的数据的存放目录
datadir=D:\\app\\mysql8\\data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=10
# 服务端使用的字符集默认为utf8mb4
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
3.安装mysql
3.1 切换到bin目录
C:\\Windows\\system32>cd d:
D:\\
C:\\Windows\\system32>d:
D:\\>cd app
D:\\app>cd mysql8
D:\\app\\mysql8>cd bin
3.2 初始化mysql
mysqld --initialize --console
初始化完成后会生成一个随机密码
D:\\app\\mysql8\\bin>mysqld --initialize --console
2021-02-25T15:48:45.282852Z 0 [System] [MY-013169] [Server] D:\\app\\mysql8\\bin\\mysqld.exe (mysqld 8.0.22) initializing of server in progress as process 5968
2021-02-25T15:48:45.292098Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-02-25T15:48:45.800039Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-02-25T15:48:46.606846Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 8)ZoGijNK40R
4.安装mysql
D:\\app\\mysql8\\bin>mysqld --install
Service successfully installed.
5.启动mysql
D:\\app\\mysql8\\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
6.登录数据库
D:\\app\\mysql8\\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor. Commands end with ; or \\g.
Your MySQL connection id is 8
Server version: 8.0.22
Copyright (c) 2000, 2020, 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.
7.修改root密码
mysql> ALTER USER \'root\'@\'localhost\' IDENTIFIED BY \'123456\'
-> ;
Query OK, 0 rows affected (0.01 sec)
mysql>
以上是关于MySQL解压版安装教程的主要内容,如果未能解决你的问题,请参考以下文章