- 下载zip包
进入官网下载页面:http://dev.mysql.com/downloads/mysql/
下载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
| Signature - 解压zip包
解压zip包到E:developdatabasemysql - 配置环境变量
新增MYSQL_HOME变量
MYSQL_HOME
E:developdatabasemysqlmysql-5.6.21在PATH变量后追加
;%MYSQL_HOME%in
- 修改配置文件
复制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:developdatabasemysqlmysql-5.6.21jian.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: 0 mysql> 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