Windows10-MySQL 5.6.38 安装步骤

下载
去MySQL官网下载:https://dev.mysql.com/downloads/mysql/5.6.html#downloads

我下载的是5.6.38 windows 64位版本,或者访问下面地址,并选择相应版本下载。

https://downloads.mysql.com/archives/community/

安装服务
1.解压MySQL压缩包说明:这里说的指定位置一般是开发者计算机上固定存放软件的路径。注意:这个路径不要带中文、特殊字符和空格。例如,我把解压以后的文件和文件夹存放在了

E:\software\mysql-5.6.38-winx64

2.修改配置文件,这里网上很多资料说需要新建个my.ini,然后配置。其实在本来的my-default.ini上进行修改就可以。

配置项:
[mysqld]
basedir=E:\software\mysql-5.6.38-winx64
datadir=E:\software\mysql-5.6.38-winx64\data
max_connections=4000
innodb_lock_wait_timeout=500
character-set-server=utf8
port = 3306
#创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

3.添加环境变量(非必须)
将以下目录添加到环境变量 path 中:
E:\software\mysql-5.6.38-winx64\bin

4.通过命令安装MySQL服务
1.必须已管理员身份运行: cmd
2.进入目录: C:\Users\Administrator>e:
3.到指定目录下:cd E:\software\mysql-5.6.38-winx64\bin
4.安装服务:mysqld -install
5.启动服务:net start mysql

cmd 执行命令:

Microsoft Windows [版本 10.0.16299.1087]
(c) 2017 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>e:

E:\>cd E:\software\mysql-5.6.38-winx64\bin

E:\software\mysql-5.6.38-winx64\bin>mysqld -install
Service successfully installed.

E:\software\mysql-5.6.38-winx64\bin>net start mysql
MySQL 服务正在启动 ..
MySQL 服务已经启动成功。

E:\software\mysql-5.6.38-winx64\bin>

5. 修改root账号的密码
刚安装完成时root账号默认密码为空,此时可以将密码修改为指定的密码。如:123456
c:>mysql –uroot
mysql>show databases;
mysql>use mysql;
mysql>UPDATE user SET password=PASSWORD("123789") WHERE user='root';
mysql>FLUSH PRIVILEGES;
mysql>QUIT

cmd 执行命令:

E:\software\mysql-5.6.38-winx64\bin>mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.38 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 |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql> use mysql
Database changed
mysql> UPDATE user SET password=PASSWORD("123789") WHERE user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

E:\software\mysql-5.6.38-winx64\bin>

创建数据库
E:\software\mysql-5.6.38-winx64\bin>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.38 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> use mysql
Database changed
mysql> show databases
-> ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql> create user 'bpms_v1'@'%' identified by 'bpms!#admin2020';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'bpms_v1'@'%' IDENTIFIED BY 'bpms!#admin2020' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges ;
Query OK, 0 rows affected (0.00 sec)

mysql> select user,host,password from mysql.user;
+---------+-----------+-------------------------------------------+
| user | host | password |
+---------+-----------+-------------------------------------------+
| root | localhost | *E02AAE229B0AC05D457B148C9A61D65920337ABE |
| root | 127.0.0.1 | *E02AAE229B0AC05D457B148C9A61D65920337ABE |
| root | ::1 | *E02AAE229B0AC05D457B148C9A61D65920337ABE |
| | localhost | |
| bpms_v1 | % | *E435F235F8ED8D1420D4631FEDD8ED58FB904414 |
+---------+-----------+-------------------------------------------+
5 rows in set (0.00 sec)

mysql>

远程连接:

IP:本机IP 端口:3306 MySQL版本:5.6.38

账号:bpms_v1

密码:bpms!#admin2020

posted @ 2020-09-11 09:06  深海蓝精灵  阅读(412)  评论(0编辑  收藏  举报