mysql-5.7.20-winx64安装教程
程序员文章站
2022-04-06 18:45:55
...
mysql-5.7.20-winx64安装教程
1.下载解压
下载mysql-5.7.20-winx64.zip并解压缩,链接:https://pan.baidu.com/s/1c2CUMI0 密码:ssst,本文解压到D:\Program Files\mysql-5.7.20-winx64
2.环境变量
系统变量配置MYSQL_HOME以及Path
3.my.ini配置
在解压目录下找到bin目录,并且新增my.ini文件,文件内容如下
[client]
default-character-set=utf8
[mysqld]
port=3306
basedir=%MYSQL_HOME%
datadir=%MYSQL_HOME%\data
character-set-server=utf8
default-storage-engine=INNODB
[mysql]
default-character-set=utf8
4.cmd操作
以系统管理员身份运行cmd,依次执行命令
cd进入到bin目录(不知道为啥没进入目录的时候,后面无法启动服务)
初始化数据库,不生成随机密码(会在mysql目录生成data目录,如果已经有data目录了那就先手动删除)
安装mysql服务
启动mysql服务
初始化root用户密码为123456
尝试登陆mysql
C:\Windows\system32>D:
D:\>cd D:\Program Files\mysql-5.7.20-winx64\bin
D:\Program Files\mysql-5.7.20-winx64\bin>mysqld --initialize-insecure
D:\Program Files\mysql-5.7.20-winx64\bin>mysqld --install
Service successfully installed.
D:\Program Files\mysql-5.7.20-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
D:\Program Files\mysql-5.7.20-winx64\bin>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.
D:\Program Files\mysql-5.7.20-winx64\bin>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.20 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>
上一篇: 图-迪杰斯特拉(Dijkstra)算法详解(含全部代码)
下一篇: 工厂的烦恼(Floyed)