mysql-5.7.20-winx64安装(自测有效)

mysql-5.7.20-winx64安装教程

1.下载解压

下载mysql-5.7.20-winx64.zip并解压缩,链接: https://pan.baidu.com/s/1geFWRy7 密码: j678,本文解压到D:\Program Files\mysql-5.7.20-winx64 
解压缩

2.环境变量

系统变量配置MYSQL_HOME以及Path 
配置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
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

my.ini

(在后面启动服务时时有些朋友会出现:“mysql 服务无法启动 服务没报告任何错误”, 其实mysql在5.6后就没有了data目录,很多朋友按照以前的版本安装会去创建一个data目录,这样就会无法启动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>mysqld --initialize-insecure --user=mysql

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>
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
还在命令模式下,将目录切换到自己的\bin目录下。

输入mysql -u root -p ,默认是没有密码的。回车进入,root是用户名,



5.2 初始化密码

       在root用户登录mysql状态下,输入SET PASSWORD FOR root=PASSWORD('password')

5.3 查看数据库和数据表

mysql>show databases;

mysql>use sys;

mysql>show tables;

5.3 退出mysql>输入

5.4 注意:当输入命令时,换行并不会让mysql终止输入并执行命令,当需要执行命令时,需要在命令后添加一个分号(;)



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值