mysql应用学习-windows(64位)安装和配置mysql(5.6.20)

时间:2022-01-17 17:10:14

下载安装包MySQL Installer

下载地址1:http://dev.mysql.com/downloads/windows/installer/

说明:官网当前版本 5.6.22;虽然只有32位的安装包,但是根据官网的描述说明,安装包应该同时支持windows32位和windows64位系统;

Note: MySQL Installer is 32 bit, but will install both 32 bit and 64 bit binaries

下载地址2:http://pan.baidu.com/s/1eQvPSfo

说明:我使用的是免安装的mysql-5.6.20-winx64压缩包,以下配置步骤以这个压缩包为准。你可以前往我的百度网盘下载;

安装和配置mysql-5.6.20-winx64

step1. 解压目录

  将下载好的压缩包解压到D:\mysql-5.6.20-winx64下;

step2. 配置my.ini文件

  复制一份目录下的my-default.ini文件重命名my.ini,配置如下:

basedir=D:/mysql-5.6.20-winx64  //安装目录

datadir=D:/mysql-5.6.20-winx64/data //数据库存放目录

配置代码:

 

mysql应用学习-windows(64位)安装和配置mysql(5.6.20)mysql应用学习-windows(64位)安装和配置mysql(5.6.20)
# 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
= .....
# datadir
= .....
# port
= .....
# server_id
= .....

basedir
=D:/mysql-5.6.20-winx64
datadir
=D:/mysql-5.6.20-winx64/data
character
-set-server=utf8
#character
-set-connection=utf8
#character
-set-results=utf8

# 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

[mysql]


[client]
View Code

 

step3. 配置环境变量

  将将D:\mysql-5.6.20-winx64\bin加入path中,以分号结束。

step4. 输出日志到控制台

  在控制台命令窗口进入D:\mysql-5.6.20-winx64\bin目录,输入命令mysql --console

mysql应用学习-windows(64位)安装和配置mysql(5.6.20)

 step5. 注册mysql为windows service

  输入命令:D:\mysql-5.6.20-winx64\bin>mysqld install

  成功提示:Service successfully installed.

step6. 启动服务

  运行services.msc进入服务列表,手动启动刚安装好的MySQL服务;

mysql应用学习-windows(64位)安装和配置mysql(5.6.20)

step7. 使用root用户登陆mysql

  root用户默认密码为空,直接回车即可;下面是登陆成功界面:

mysql应用学习-windows(64位)安装和配置mysql(5.6.20)

step8. 修改root用户登陆密码

  输入命令:grant all on *.* to 'root'@'localhost' identified by '123456';

  成功提示:Query OK, 0 rows affected (0.00 sec)

 

在此要感谢“企业宝”写的博客带我入门,博主博客:http://www.cnblogs.com/qiyebao/p/3887055.html。