【Data Science】【MySQL】在 Windows 下使用 zip 包部署 MySQL5.6

本文介绍如何在 Windows 下使用 zip 包部署 MySQL5.6 环境.

1. 下载 MySQL Server 预编译压缩包

MySQL Community Server 页面下载 mysql-5.6.24-winx64.zip 压缩包.

  • Product Version: 5.6.24 \fcolorbox{black}{white}{5.6.24} 5.6.24
  • Operating System: Microsoft Windows \fcolorbox{black}{white}{Microsoft Windows} Microsoft Windows
  • OS Version: Windows (x86, 64-bit) \fcolorbox{black}{white}{Windows (x86, 64-bit)} Windows (x86, 64-bit)

解压到指定目录:

D:\Applications (portable)\MySQL\MySQL Server 5.6.24

在这里插入图片描述

2. 设置环境变量

D:\Applications (portable)\MySQL\MySQL Server 5.6.24\bin

激活设置.

3. 修改配置文件

进入 D:\Applications (portable)\MySQL\MySQL Server 5.6.24\ 目录,复制 my-default.ini 并重命名为 my.ini.

编辑 my.ini.

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
basedir = D:\Applications (portable)\MySQL\MySQL Server 5.6.24
datadir = D:\Applications (portable)\MySQL\MySQL Server 5.6.24\data
port = 3306
# server_id = .....


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

4. 安装 MySQL 服务

以管理员权限打开命令提示符.

初始化 MySQL 服务

>mysqld --initialize-insecure --user=mysql

安装 MySQL 服务

>mysqld install

启动 MySQL 服务

>net start mysql

在这里插入图片描述

5. 登录 MySQL 命令行并修改 root 密码

以 root 账户登录 MySQL:

>mysql -u root -p

此时 root 账户密码还未设置,为空密码,直接回车登录:

>mysql -u root -p
Enter password:

登录成功,如下所示:

>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.24 MySQL Community Server (GPL)

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

修改 root 账户密码. 修改密码为 123456

mysql> use mysql;
mysql> update user set password=password('123456') where user='root';
mysql> flush privileges;

再次登录时需要输入密码.

6. 下载 MySQL Workbench 预编译压缩包

MySQL Workbench 页面下载 mysql-workbench-community-6.2.5-winx64-noinstall.zip 压缩包.

  • Product Version: 6.2.5 \fcolorbox{black}{white}{6.2.5} 6.2.5
  • Operating System: Microsoft Windows \fcolorbox{black}{white}{Microsoft Windows} Microsoft Windows
  • OS Version: Windows (x86, 64-bit) \fcolorbox{black}{white}{Windows (x86, 64-bit)} Windows (x86, 64-bit)

解压到指定目录:

D:\Applications (portable)\MySQL\MySQL Workbench 6.2.5 CE (winx64)

在这里插入图片描述

双击 MySQLWorkbench.exe 启动程序:
在这里插入图片描述
双击 localhost 连接实例,仅有 test 数据库:
在这里插入图片描述

7. 卸载方法

卸载方法非常简单.

以管理员权限打开命令提示符.

关闭 mysql 服务:

>net stop mysql

卸载 mysql 服务:

>mysqld remove

删除文件目录和环境变量即可.

猜你喜欢

转载自blog.csdn.net/RadiantJeral/article/details/113820187