安装MySQL

  1. 下载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
  2. 解压zip包
    解压zip包到E:\develop\database\mysql\
  3. 配置环境变量
    新增MYSQL_HOME变量
    MYSQL_HOME
    E:\develop\database\mysql\mysql-5.6.21

    在PATH变量后追加

    ;%MYSQL_HOME%\bin 
  4. 修改配置文件
    复制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. Its 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 
  5. 安装
    以管理员身份运行cmd,输入命令:
    mysqld install jianSQLService --defaults-file="E:\develop\database\mysql\mysql-5.6.21\jian.ini"
  6. 启动
    net start jianSQLService
  7. 登录
    mysql -P3366 -uroot -p

    参数说明:
    -h: mysql服务器地址。若本机,可省略;
    -P: mysql服务器端口。若默认3306,可省略;
    -u: 用户名;
    -p: 密码。密码为空,可省略。

  8. 修改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)
  9. 关闭
    net stop jianSQLService
  10. 卸载
    慎用
    。在放弃使用MySQL时,才用到此项
    以管理员身份运行cmd,输入命令:
    mysqld –remove

    或者

    sc delete jianSQLService

     

  11. 参考
    http://supportopensource.iteye.com/blog/1415527

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。