- 下载zip包进入官网下载页面:下载mysql-5.6.23-win32.zip:
Windows (x86, 32-bit), ZIP Archive 5.6.23 342.3M (mysql-5.6.23-win32.zip) MD5: d55ea458590c92060a790ba22e9b4222
| - 解压zip包解压zip包到E:\develop\database\mysql\
- 配置环境变量新增MYSQL_HOME变量
MYSQL_HOME E:\develop\database\mysql\mysql-5.6.21
在PATH变量后追加
;%MYSQL_HOME%\bin
- 修改配置文件复制my-default.ini为自己使用的配置文件(如: jian.ini),编辑后最终得jian.ini以下内容:
# 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.[mysql] #设置mysql客户端的字符集 default-character-set = utf8[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 = 256M# 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.# 设置mysql的安装目录basedir = E:/develop/database/mysql/mysql-5.6.21# 设置mysql数据库的数据的存放目录datadir = E:/develop/database/mysql/mysql-5.6.21/data# 设置绑定端口port = 3366# server_id = .....#设置服务器段的字符集 character_set_server = utf8# 允许最大连接数max_connections = 10# 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
- 安装以管理员身份运行cmd,输入命令:
mysqld install jianSQLService --defaults-file="E:\develop\database\mysql\mysql-5.6.21\jian.ini"
- 启动
net start jianSQLService
- 登录
mysql -P3366 -uroot -p
参数说明:
-h: mysql服务器地址。若本机,可省略;-P: mysql服务器端口。若默认3306,可省略;-u: 用户名;-p: 密码。密码为空,可省略。 - 修改root密码
mysql> update mysql.user set password=password("jian") where User="root";Query OK, 3 rows affected (0.00 sec)Rows matched: 3 Changed: 3 Warnings: 0mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
- 关闭
net stop jianSQLService
- 卸载慎用。在放弃使用MySQL时,才用到此项。以管理员身份运行cmd,输入命令:
mysqld –remove
或者
sc delete jianSQLService
- 参考http://supportopensource.iteye.com/blog/1415527