您的位置:首页 > 数据库 > MySQL

Windows配置MySQL(5.6.20)免安装版

2016-10-22 01:26 375 查看
1.首先到http://dev.mysql.com/ 上下载windows版mysql5.6免安装zip包。然后将zip包解压到D:\mysql-5.6.20-winx64下。

2.在D:\mysql-5.6.20-winx64下创建my.ini。

注意!!!如果你不是解压到D:\mysql-5.6.20-winx64,下面第23、24、29、31行的代码要改成你的安装目录!!!

内容如下:

# 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]
character-set-server=utf8

# 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
port=13306

character-set-server=utf8
default-storage-engine=INNODB
innodb_data_home_dir=D:/mysql-5.6.20-winx64/data
innodb_data_file_path=ibdata1:12M:autoextend
innodb_log_group_home_dir=D:/mysql-5.6.20-winx64/data

innodb_buffer_pool_size=10240M
innodb_log_file_size=4G
innodb_lock_wait_timeout = 500
# 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
3.设置环境变量。
进入系统属性,点下面的环境变量。



系统变量底下点新建



如下图所示,填写完毕后点确定。(我的是D:\mysql-5.6.20-winx64\bin,你需要改成自己的bin目录)



找到系统变量中的Path,点下面的编辑。



点编辑文本。



在变量值最后加上;%MYSQL_HOME%(注意前面有分号后面没有分号!!!)



4.管理员身份进入命令提示符

输入:

mysqld --console



5.注册mysql为windows service. 以后可以使用windows service来安装mysql和卸载mysql的服务。

进入D:\mysql-5.6.20-winx64\bin目录



安装mysql服务

mysqld install




(卸载mysql服务 mysqld remove)

进入服务,控制面板-管理工具-服务(以管理员身份运行)





启动MySQL服务



net start mysql --启动mysql服务
net stop mysql --停止mysql服务




使用root用户登陆数据库,端口号为13306,密码为空

mysql -P13306 -u root -p


查看数据库文件存放路径

show global variables like "%datadir%";


查看所有数据库

show databases;


密码改为ROOT

GRANT ALL ON *.* TO 'root'@'localhost' IDENTIFIED BY 'ROOT';




show engines; --查看MySQL存储引擎
\q
9b62
--退出MySQL


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息