快消品货源批发市场
快消品货源分销平台
 
 
当前位置: 货源批发网 » 网商学院 » 独立商城 » MySQL Win免安装版配置

MySQL Win免安装版配置

放大字体  缩小字体 发布日期:2024-11-10 10:21:32  来源:电商联盟  作者:乐发网  浏览次数:1

1、下载MySQL-5.6.10-winx64.zip(官网没有64位msi安装文件,否则不用手动配置这么麻烦);
2、 解压至某一目录,比如D:\code\mysql-5.6.10-winx64,这是MySQL的程序目录;
3、将D:\code\mysql-5.6.10-winx64\bin添加到path环境变量;
4、新建一目录,作为MySQL数据目录,如D:\code\mysql_data,将D:\code\mysql-5.6.10-winx64\data复制到D:\code\mysql_data\data,这里面有MySQL自带的数据库和一些日志文件;
5、将D:\code\mysql-5.6.10-winx64里的my-default.ini配置文件移到D:\code\mysql_data,重命名为my.ini,当然也可以不这样组织目录结构,系统搜索my.ini选项文件的顺序可以参看http://dev.mysql.com/doc/refman/5.1/en/option-files.html;
6、编写my.ini文件,比如我的:
[html] view plain copy
[WinMySQLAdmin]
Server=D:/code/mysql-5.6.10-winx64/bin/mysqld.exe

[client]
no-beep

# pipe
# socket=mysql
port=3306

[mysql]

default-character-set=utf8

# 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]

explicit_defaults_for_timestamp = TRUE

# 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 = 2G

# 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:\code\mysql-5.6.10-winx64\"
datadir="D:\code\mysql_data\data\"

port=3306
server_id=1

general-log=0
general_log_file="mysql_general.log"
slow-query-log=1
slow_query_log_file="mysql_slow_query.log"
long_query_time=10

log-error="mysql_error_log.err"


default-storage-engine=INNODB
max_connections=1024
query_cache_size=128M
key_buffer_size=128M
innodb_flush_log_at_trx_commit=1
innodb_thread_concurrency=128
innodb_autoextend_increment=128M
tmp_table_size=128M


# 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
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
character-set-server=utf8

其中
[html] view plain copy
[WinMySQLAdmin]
Server=D:/code/mysql-5.6.10-winx64/bin/mysqld.exe

组是我net start mysql后控制台提示出错,找不到指定文件后添加的,
[html] view plain copy
explicit_defaults_for_timestamp = TRUE

属性是mysqld --install MySQL --defaults-file=D:\code\mysql_data\my.ini后提示
[html] view plain copy
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
Please use --explicit_defaults_for_timestamp server option (see
documentation for more details).

添加的,
[html] view plain copy
basedir="D:\code\mysql-5.6.10-winx64\"
datadir="D:\code\mysql_data\data\"

分别指向MySQL的程序目录和数据目录,注意写路径时可能出现的一些错误,如双引号、路径分隔符,其余的属性主要是优化MySQL配置的,可以通过show status查看;
7、输入mysqld --install MySQL --defaults-file=D:\code\mysql_data\my.ini命令,将mysql作为win系统服务,如果出错或想重命名服务名,可以mysqld --remove,具体可以看http://dev.mysql.com/doc/refman/5.1/en/windows-start-service.html;
8、输入net start mysql启动服务;
OK,现在就可以通过mysql -h127.0.0.1 -P3306 -utest -p来跑数据库了。

乐发网超市批发网提供超市货源信息,超市采购进货渠道。超市进货网提供成都食品批发,日用百货批发信息、微信淘宝网店超市采购信息和超市加盟信息.打造国内超市采购商与批发市场供应厂商搭建网上批发市场平台,是全国批发市场行业中电子商务权威性网站。

本文内容整合网站:百度百科知乎淘宝平台规则

本文来源: MySQL Win免安装版配置

分享与收藏:  网商学院搜索  告诉好友  关闭窗口  打印本文 本文关键字:
 
更多..资源下载
独立商城图文
独立商城网商学院推荐
独立商城点击排行
 
手机版 手机扫描访问