mysql-5.7.33-winx64.zip安装教程
1.下载解压:
下载mysql-5.7.33-winx64.zip并解压缩,链接:
https://dev.mysql.com/downloads/mysql/
在这可以选择不同的mysql,本教程以mysql-5.7.33-winx64.zip
点击Downland,,跳转到新的页面,点击No,thanks,just start download 触发下载:
将下载好的压缩包解压:
解压后的文件夹,在没有安装前只有以下文件夹:
2.环境变量:
系统变量配置MYSQL_HOME以及Path %MYSQL_HOME%
3.my.ini配置:
在解压的目录下找到bin目录,并且新增my.ini文件,文件通过文本编辑器增加内容如下:
[client]
default-character-set=utf8mb4
[mysqld]
port=3306
basedir=%MYSQL_HOME%
datadir=%MYSQL_HOME%\data
character-set-server=utf8mb4
default-storage-engine=INNODB
[mysql]
default-character-set=utf8mb4
4.cmd 操作:
以系统管理员身份运行cmd,依次执行命令
初始化数据库,不生成随机密码(会在mysql目录生成data目录,如果已经有data目录了那就先手动删除)
安装mysql服务
启动mysql服务
初始化root用户密码为123456
尝试登陆mysql
C:\Users\Administrator>mysqld --initialize-insecure
C:\Users\Administrator>mysqld --install
Service successfully installed.
C:\Users\Administrator>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
C:\Users\Administrator>mysqladmin -u root password 123456
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
C:\Users\Administrator>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.33 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql>