地址:http://dev.mysql.com/downloads/mysql/
2. 解压zip 文件. 在mysql 的根目录下找到 my-default.ini 复制出一个 my.ini 文件, 根据你需要的位置修改 my.ini 文件
a)在[mysqld]下追加
-------
basedir = d://mysql
datadir = d://mysql//data
character-set-server = utf8
-------
b) 在[client]下追加
-------
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]# 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:/work/mysql-5.6.17-winx64datadir =f:/db-data/mysqlcharacter-set-server = 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 [client]default-character-set = utf8
3. 启动服务
保存
my.ini
的配置,然后打开命令行切换到mysql解压目录下的bin 目录;
执行 mysqld.exe console 命令测试一下
d:/work/mysql-5.6.17-winx64/bin>mysqld.exe console2014-04-22 19:11:09 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details).
然后执行 mysqld.exe console 命令启动mysql
d:/work/mysql-5.6.17-winx64/bin>mysqld.exe --console2014-04-22 19:11:33 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details).2014-04-22 19:11:33 5624 [note] plugin 'federated' is disabled.mysqld.exe: table 'mysql.plugin' doesn't exist2014-04-22 19:11:33 5624 [error] can't open the mysql.plugin table. please run mysql_upgrade to create it.2014-04-22 19:11:33 5624 [note] innodb: using atomics to ref count buffer pool pages2014-04-22 19:11:33 5624 [note] innodb: the innodb memory heap is disabled2014-04-22 19:11:33 5624 [note] innodb: mutexes and rw_locks use windows interlocked functions2014-04-22 19:11:33 5624 [note] innodb: compressed tables use zlib 1.2.32014-04-22 19:11:33 5624 [note] innodb: not using cpu crc32 instructions2014-04-22 19:11:33 5624 [note] innodb: initializing buffer pool, size = 128.0m2014-04-22 19:11:33 5624 [note] innodb: completed initialization of buffer pool2014-04-22 19:11:33 5624 [note] innodb: highest supported file format is barracuda.2014-04-22 19:11:33 5624 [note] innodb: 128 rollback segment(s) are active.2014-04-22 19:11:33 5624 [note] innodb: waiting for purge to start2014-04-22 19:11:33 5624 [note] innodb: 5.6.17 started; log sequence number 16006072014-04-22 19:11:33 5624 [warning] no existing uuid has been found, so we assume that this is the first time that this server has been started. generating a new uuid: dcd35109-ca0e-11e3-a872-003018a05bef.2014-04-22 19:11:33 5624 [note] server hostname (bind-address): '*'; port: 33062014-04-22 19:11:33 5624 [note] ipv6 is available.2014-04-22 19:11:33 5624 [note] - '::' resolves to '::';2014-04-22 19:11:33 5624 [note] server socket created on ip: '::'.2014-04-22 19:11:33 5624 [error] fatal error: can't open and lock privilege tables: table 'mysql.user' doesn't exist
注:这里出现异常 :table 'mysql.user' doesn't exist 是因为我没有吧数据文件复制到 my.ini 里面配置的路径下,
数据文件是在 mysql 解压目录的下 的 data 目录, 吧整个目录里的内容复制到配置文件里写的目录里,然后启动
d:/work/mysql-5.6.17-winx64/bin>mysqld.exe --console2014-04-22 19:16:31 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details).2014-04-22 19:16:31 6180 [note] plugin 'federated' is disabled.2014-04-22 19:16:31 6180 [note] innodb: using atomics to ref count buffer pool pages2014-04-22 19:16:31 6180 [note] innodb: the innodb memory heap is disabled2014-04-22 19:16:31 6180 [note] innodb: mutexes and rw_locks use windows interlocked functions2014-04-22 19:16:31 6180 [note] innodb: compressed tables use zlib 1.2.32014-04-22 19:16:31 6180 [note] innodb: not using cpu crc32 instructions2014-04-22 19:16:31 6180 [note] innodb: initializing buffer pool, size = 128.0m2014-04-22 19:16:31 6180 [note] innodb: completed initialization of buffer pool2014-04-22 19:16:32 6180 [note] innodb: highest supported file format is barracuda.2014-04-22 19:16:32 6180 [note] innodb: 128 rollback segment(s) are active.2014-04-22 19:16:32 6180 [note] innodb: waiting for purge to start2014-04-22 19:16:32 6180 [note] innodb: 5.6.17 started; log sequence number 16259872014-04-22 19:16:32 6180 [warning] no existing uuid has been found, so we assume that this is the first time that this server has been started. generating a new uuid: 8f19129f-ca0f-11e3-a876-003018a05bef.2014-04-22 19:16:32 6180 [note] server hostname (bind-address): '*'; port: 33062014-04-22 19:16:32 6180 [note] ipv6 is available.2014-04-22 19:16:32 6180 [note] - '::' resolves to '::';2014-04-22 19:16:32 6180 [note] server socket created on ip: '::'.2014-04-22 19:16:32 6180 [note] event scheduler: loaded 0 events2014-04-22 19:16:32 6180 [note] mysqld.exe: ready for connections.version: '5.6.17' socket: '' port: 3306 mysql community server (gpl)
证明mysql服务已启动
6. 设置登陆mysql root帐号的的密码
在mysql/bin 目录下打开新的命令行,输入mysql 回车
d:/work/mysql-5.6.17-winx64/bin>mysqlwelcome to the mysql monitor. commands end with ; or /g.your mysql connection id is 1server version: 5.6.17 mysql community server (gpl)copyright (c) 2000, 2014, oracle and/or its affiliates. all rights reserved.oracle is a registered trademark of oracle corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners.type 'help;' or '/h' for help. type '/c' to clear the current input statement.mysql>
看到上面类似内容说明登陆成功,此时的root帐号是没有密码的,而我也没打算要密码
想要设置可使用命令
直接运行命令行窗口输入下面的
mysqladmin -u root password
你的密码
这样就ok了,
7. 安装mysql服务
在bin目录下执行命令
mysqld.exe --install mysql5.6.17 --defaults-file=d:/work/mysql-5.6.17-winx64/my.ini
结果如下.
d:/work/mysql-5.6.17-winx64/bin>mysqld.exe --install mysql5.6.17 --defaults-file=d:/work/mysql-5.6.17-winx64/my.iniservice successfully installed.
8.启动服务
net start mysql5.6.17
d:/work/mysql-5.6.17-winx64/bin>net start mysql5.6.17mysql5.6.17 服务正在启动 .mysql5.6.17 服务已经启动成功。
注:若启动不成功修改注册表开始->运行->regedit
找hkey_local_mechine---system ---controlset001或controlset002中找services,
再找mysql项,修改 imagepath值改为:d:/work/mysql-5.6.17-winx64/bin/mysqld --defaults-file=d:/work/mysql-5.6.17-winx64/my.ini mysql
最后为了方便添加环境变量.
mysql=d:/work/mysql-5.6.17-winx64
path=%mysql%/bin;path...
测试:
c:/windows/system32>set path=%mysql%/bin;%path%c:/windows/system32>echo pathpathc:/windows/system32>echo %path%d:/work/mysql-5.6.17-winx64/bin;d:/program files/java/jdk1.7.0_15/bin;d:/program files/java/jdk1.7.0_15/jre/bin;c:/windows/system32;c:/windows;c:/windows/system32/wbem;c:/windows/system32/windowspowershell/v1.0/c:/windows/system32>mysqlwelcome to the mysql monitor. commands end with ; or /g.your mysql connection id is 2server version: 5.6.17 mysql community server (gpl)copyright (c) 2000, 2014, oracle and/or its affiliates. all rights reserved.oracle is a registered trademark of oracle corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners.type 'help;' or '/h' for help. type '/c' to clear the current input statement.mysql>
到此结束.
