mysql 5.6.26 winx64安装配置图文教程(一)

作者:ZJDWHD 时间:2024-01-14 21:44:59 

阅读目录
• 下载MySQL免安装版
• 配置MySQL数据库
• MySQL环境变量
• 安装MySQL数据库 

公司服务器是Windows 开发连接的数据库使用的是"MySQL" 
此篇随笔将介绍在Windows上如何配置MySQL数据库免安装版

一、下载MySQL免安装版
 • 首先进入MySQL 官方网站 www.mysql.com  -->Downloads(下载) --> Community(社区) --> MySQL Community Server(MySQL社区服务器)-->选择操作系统平台(Windows)
• 下面有三个可选的下载文件
† 第一个是MySQL Installer 5.6 for Windows,下载下来是一个.msi可执行安装文件
† 后面两个是解压版(Zip版)分别是Windows (x86, 64-bit) ZIP Archive 和 Windows (x86, 32-bit), ZIP Archive
 • 笔者选择的是 mysql-5.6.26-winx64.zip ,因为笔者的服务器版本是64位操作系统 

二、配置MySQL数据库
 • 将下载的 mysql-5.6.26-winx64.zip 解压自定义目录,这里笔者将把这个压缩包解压至 D:\mysql-5_x64 目录;
• 打开这个目录,发现里面的文件夹和文件跟一个安装好后的MySQL基本没有区别
• 修改MySQL配置文件,在mysql-5_x64目录下有一个my-default.ini,可以算作模板来使用,里面的内容不是很多!可以自己创建一个 my.ini作为MySQL配置文件,打开my.ini 

[client] 
port=3306 
#客户端字符类型,与服务端一致就行,建议utf8 
default-character-set=utf8 
[mysqld]
 #绑定IPv4和3306端口
 bind-address = 0.0.0.0
 port = 3306 
#服务端字符类型,建议utf8 
character_set_server=utf8 
# 设置mysql的安装目录
 basedir=D:/mysql-5_x64
 # 设置mysql数据库的数据的存放目录
 datadir=D:/mysql-5_x64/data
 # 允许最大连接数
 max_connections=201 

 • 这样一个基本的MySQL环境所需要的参数就够了 

三、MySQL环境变量
 • 右击这台电脑-->属性-->高级-->环境变量-->"用户变量"新建变量MYSQL_HOME 值D:\mysql-5_x64 ,"系统变量"找到变量path 编辑 在后面加上  ;%MYSQL_HOME%\bin 

四、安装MySQL数据库
 •  运行cmd (Win8 、Win10以管理员运行cmd)-->进入D:\mysql-5_x64\bin目录
Microsoft Windows [版本 10.0.10240] 
(c) 2015 Microsoft Corporation. All rights reserved.
C:\Windows\system32>D:
D:\>cd mysql-5_x64
D:\mysql-5_x64>cd bin
D:\mysql-5_x64\bin> 

• 执行mysqld -install 安装MySQL 
D:\mysql-5_x64\bin>mysqld -install 
Service successfully installed 

•  执行net start mysql启动MySQL

D:\mysql-5_x64\bin>net start mysql
D:\mysql-5_x64\bin>net start mysql
MySQL 服务正在启动 . 
MySQL 服务已经启动成功

启动MySQL服务:net start mysql
停止MySQL服务:net stop mysql
删除MySQL服务:sc delete mysql

• 修改Mysql密码

D:\mysql-5_x64\bin>mysql -u root -p                              //使用root登入mysql 
Enter password:                                                 //密码空,回车即可 
Welcome to the MySQL monitor.  Commands end with ; or \g. 
Your MySQL connection id is 2 
Server version: 5.6.26 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>


mysql> show databases; //显示所有数据库
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)

• 进入'mysql'数据、删除空用户


mysql> use mysql;
Database changed
mysql> delete from user where user='';
Query OK, 1 row affected (0.00 sec)

• 更新密码并重新刷权限表到内存(也可以用mysqladmin工具来设置密码)


mysql> update User set Password=PASSWORD('123456') where User='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

• 尝试登陆


D:\mysql-5_x64\bin>mysql -u root -p //用root用户登入数据库
Enter password: ******  //输入更新后的密码 123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.26 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>

• 开启远程连接(给予全部权限,允许 192.168.1.x 网段都可以连接)


mysql> grant all privileges on *.* to 'root'@'192.168.1.%' identified by 'root' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user,password from user;
+-------------+------+-------------------------------------------+
| host | user | password  |
+-------------+------+-------------------------------------------+
| 192.168.1.% | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+-------------+------+-------------------------------------------+
4 rows in set (0.00 sec)

精彩专题分享:

mysql不同版本安装教程

mysql5.7各版本安装教程

mysql5.6各版本安装教程

mysql8.0各版本安装教程

标签:mysql5.6.26,winx64,mysql5.6
0
投稿

猜你喜欢

  • Python利用xlrd 与 xlwt 模块操作 Excel

    2022-07-19 20:57:13
  • python中的插值 scipy-interp的实现代码

    2022-02-23 02:50:09
  • Python入门_浅谈数据结构的4种基本类型

    2021-01-11 19:12:28
  • 解析:MySQL 数据库搜索中大小写敏感性

    2009-02-23 17:32:00
  • 深入理解Django的信号机制

    2023-01-20 10:19:58
  • python Flask 装饰器顺序问题解决

    2022-09-30 09:16:42
  • python爬取代理ip的示例

    2022-01-20 11:41:12
  • mysql随机查询若干条数据的方法

    2024-01-20 17:41:02
  • 深入理解JavaScript作用域和作用域链

    2024-04-10 13:54:17
  • Linux 下 Python 实现按任意键退出的实现方法

    2022-08-07 14:22:01
  • FFrpc python客户端lib使用解析

    2023-09-06 00:12:20
  • Python使用Matplotlib绘制三维散点图详解流程

    2023-09-17 13:36:59
  • ASP+Access数据库安全设置方法小结

    2011-04-02 11:09:00
  • 程序员鼓励师插件Rainbow Fart(彩虹屁)

    2023-02-11 23:02:40
  • python人工智能tensorflow函数tf.get_variable使用方法

    2021-09-14 22:52:09
  • python实现输出一个序列的所有子序列示例

    2022-04-13 18:34:45
  • 捕捉并保存ASP运行错误的函数代码

    2012-11-30 20:24:43
  • MySQL备份与恢复之热备(3)

    2024-01-21 04:50:04
  • 50行代码实现贪吃蛇(具体思路及代码)

    2023-04-04 14:18:08
  • python使用多线程备份数据库的步骤

    2024-01-24 18:27:19
  • asp之家 网络编程 m.aspxhome.com