MySQL(压缩包)配置过程

1.下载MySQL安装包
MySQL :: Download MySQL Community Server

2.将下载完成的压缩包解压到某一目录,如:

C:\MySQL

并在系统环境中添加以上目录。

 3.在上述目录下新建my.ini文件,并在文件中输入以下内容:

[mysqld]
port=3306
basedir=C:\MySQL
datadir=C:\MySQL\data
max_connections=200
max_connect_errors=10
character-set-server=utf8mb4
default-storage-engine=INNODB
default-storage-engine=INNODB
[mysql]
default-character-set=utf8mb4
[client]
port=3306
default-character-set=utf8mb4

4.使用命令

1 mysqld --initialize --console

初始化MySQL服务,并记下此处生成的root用户的初始密码:

C:\Windows\System32>mysqld --initialize --console
2024-10-13T12:10:48.416788Z 0 [System] [MY-013169] [Server] C:\MySQL\bin\mysqld.exe (mysqld 8.0.39) initializing of server in progress as process 15240
2024-10-13T12:10:48.446955Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-10-13T12:10:48.801853Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-10-13T12:10:51.121715Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: wy+LuYklk3y4

5.安装并启动MySQL服务:

C:\Windows\System32>mysqld install
Service successfully installed.

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

6.使用先前生成的密码登录root用户并使用命令

1 ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

修改其密码:

C:\Windows\System32>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.39

Copyright (c) 2000, 2024, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.01 sec)

 

 

 

posted @ 2024-10-13 20:25  peach1  阅读(63)  评论(0编辑  收藏  举报