zoukankan      html  css  js  c++  java
  • mysql-5.7.12-winx64.zip Windows (x86, 64-bit), ZIP Archive版免安装配置

    1、下载免安装版压缩包

      下载地址:http://dev.mysql.com/downloads/mysql/

    • 选择符合你的操作系统的版本,点击download进入下载页面

    • 不用注册也可以点击下载连接进行下载

    2、安装

    • 解压下载的压缩文件到你的mysql安装目录(目录能不能有中文没测试过,你可以试一下),以下是我的解压目录

     

    • 复制解压目录D:javaEnvironmentmysql-5.7.12-winx64下的my-default.ini命名为my.ini,打开my.ini添加如下配置、保存:
    # For advice on how to change settings please see
    # http://dev.mysql.com/doc/refman/5.7/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.
    [client]
    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 = 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.
    
    #skip-grant-tables
    
    basedir = "D:javaEnvironmentmysql-5.7.12-winx64"
    datadir = "D:javaEnvironmentmysql-5.7.12-winx64data"
    tmpdir = "D:javaEnvironmentmysql-5.7.12-winx64data"
    socket = "D:javaEnvironmentmysql-5.7.12-winx64datamysql.sock"
    port = 3306
    log-error = "D:javaEnvironmentmysql-5.7.12-winx64datamysql_error.log"
    # server_id = .....
    max_connections = 100
    table_open_cache = 256
    query_cache_size = 1M
    tmp_table_size = 32M
    thread_cache_size = 8
    innodb_data_home_dir = "D:javaEnvironmentmysql-5.7.12-winx64data"
    innodb_flush_log_at_trx_commit = 1
    innodb_log_buffer_size = 128M
    innodb_buffer_pool_size = 128M
    innodb_log_file_size = 10M
    innodb_thread_concurrency = 16
    innodb-autoextend-increment = 1000
    # 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 = 32M
    read_rnd_buffer_size = 32M
    max_allowed_packet = 32M
    explicit_defaults_for_timestamp = true
    
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
    • 设置环境变量,在环境变量path变量中后面添加上上面的mysql解压目录的bin路劲D:javaEnvironmentmysql-5.7.12-winx64in,注意添加前加上‘;’号
    • win+r,输入cmd进入windows Dos界面
    • 进入解压的/bin目录下,(重要)执行命令mysqld --initialize,5.7之后需要初始化生成数据库文件(根目录下的data文件),否则后续无法启动服务
    • 执行命令mysqld -install,安装mysql服务
    • 执行命令net start mysql,启动服务

    • 执行命令mysql -uroot -p,会报错ERROR 1045(28000),需要设置登录密码
    • 打开配置文件my.ini,将skip-grant-tables前面的#去掉,然后重启服务,再次登录就可略过密码
    • 进入mysql数据库,依次执行以下命令:

      use mysql;

      update user set authentication_string=password("root") where user="root";     //注意:这里"root"修改为你的密码,如:"123456"

      flush privileges;

      quit;

    • 打开配置文件my.ini,在skip-grant-tables前面加上#注释掉,然后重启服务,使用设置的密码再次登录

    • mysql登陆后执行:SET PASSWORD = PASSWORD('123456');    原因参考官网说明:http://dev.mysql.com/doc/refman/5.6/en/alter-user.html。(ps:英文不好,没看懂,看懂的可以给我指点一下)
    • 然后就可以在版本的mysql客户端SQLyog中连接mysql server了,但是这时候别的机器还不能访问本机的mysql server,如下三步操作解决问题:
    1. use mysql;  //进入mysql数据库
    2. update user set host = '%' where user = 'root';    //可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
    3. GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'  WITH GRANT OPTION; //赋予任何主机访问数据的权限
    4. FLUSH PRIVILEGES //修改生效
  • 相关阅读:
    WUSTOJ 1247: 递增或递减排序(Java)
    WUSTOJ 1246: 字符串排序(Java)
    Oracle查询部门工资最高员工的两种方法 1、MAX()函数 2、RANK()函数
    Oracle数据库——用户(USER)
    Firefox在新标签页打开“书签”和“搜索栏”(无需插件)
    Oracle数据库——ROWNUM
    Oracle数据库 SET ECHO [ON|OFF]
    WUST Oracle数据库 实验一实验二
    优课在线 嵌入式系统(胡威)2018春季测验 参考解析
    Oracle数据库——查询所有用户
  • 原文地址:https://www.cnblogs.com/xrab/p/5395242.html
Copyright © 2011-2022 走看看