Windows Server 2008怎么安装MySQL Community Server 5.7.16

41次阅读
没有评论

共计 3010 个字符,预计需要花费 8 分钟才能阅读完成。

本篇内容介绍了“Windows Server 2008 怎么安装 MySQL Community Server 5.7.16”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让丸趣 TV 小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

0. 下载安装介质

    我们可以登录 MySQL 官网来下载安装介质,网址是:http://dev.mysql.com/downloads/。我选择的是 64 位压缩包版本“Windows (x86, 64-bit), ZIP Archive”。

1. 解压缩

将下载到本地的安装介质解压缩。然后,将解压后的文件夹 mysql-5.7.16-winx64 拷贝到安装目录 (E 盘根目录) 下。

2. 设置系统环境变量

右键点击 计算机 属性 高级系统属性 环境变量 编辑 Path,在最后添加” ;E:\mysql-5.7.16-winx64\bin“,确定。

3. 创建 my.ini 文件和 data 目录,配置安装路径与数据存储路径

在 E:\mysql-5.7.16-winx64 目录下创建 data 目录和 my.ini,并在 my.ini 中配置安装路径与数据存储路径等信息。

点击 (此处) 折叠或打开

[mysql]

default-character-set=utf8

[mysqld]

max_connections=200

default-storage-engine=INNODB

basedir =E:\mysql-5.7.16-winx64\bin

datadir =E:\mysql-5.7.16-winx64\data

port = 3306

4. 安装 MySQL 服务
首先,以管理员身份运行 cmd 并切换到 MySQL 的 bin 目录下;
接下来,执行 mysqld –initialize-insecure
    这条命令用来初始化 data 文件,其中 insecure 选项指定登录无需口令。

点击 (此处) 折叠或打开

D:\ e:

E:\ cd mysql-5.7.16-winx64

E:\mysql-5.7.16-winx64 cd bin

E:\mysql-5.7.16-winx64\bin mysqld –initialize-insecure

E:\mysql-5.7.16-winx64\bin

需要注意的是,如果不指定 insecure 选项,则会随机生成登陆密码,在 E:\mysql-5.7.16-winx64\data 文件夹下,有一个 hoegh.err 文件,其中 hoegh 是主机名,打开会看到:
2016-10-20T09:34:56.806257Z 1 [Note] A temporary password is generated for root@localhost: p-mcI:ijR6Xg,
其中  p-mcI:ijR6Xg 即为随机密码。

然后,输入  mysqld –install 安装 MySQL 服务

我们会看到界面出现:Server successfully installed,这就说明 MySQL 服务安装成功。 

点击 (此处) 折叠或打开

E:\mysql-5.7.16-winx64\bin

E:\mysql-5.7.16-winx64\bin mysqld –install

Service successfully installed.

E:\mysql-5.7.16-winx64\bin

5. 启动 MySQL 服务

输入  net start mysql  回车,就会看到:MySQL 服务已经启动成功。尝试使用 root 用户登录数据库,并通过 show databases 命令查看数据库概要信息。

点击 (此处) 折叠或打开

E:\mysql-5.7.16-winx64\bin

E:\mysql-5.7.16-winx64\bin net start mysql

MySQL 服务正在启动 .

MySQL 服务已经启动成功。

E:\mysql-5.7.16-winx64\bin mysql -u root

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.7.16 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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

6. 修改 root 密码

    安全起见,我们修改一下 root 密码。

点击 (此处) 折叠或打开

mysql

mysql alter user root @ localhost identified by root

Query OK, 0 rows affected (0.00 sec)

mysql

mysql exit

Bye

E:\mysql-5.7.16-winx64\bin mysql -u root -proot

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.7.16 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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

“Windows Server 2008 怎么安装 MySQL Community Server 5.7.16”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注丸趣 TV 网站,丸趣 TV 小编将为大家输出更多高质量的实用文章!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-19发表,共计3010字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)