美文网首页工具
MySQL 5.7.24 绿色版安装手记

MySQL 5.7.24 绿色版安装手记

作者: 帅可儿妞 | 来源:发表于2018-11-03 01:15 被阅读204次

    已经很长时间了,官网不再提供MySQL的Installer,然而压缩包安装很麻烦,今天就来记一下手动安装的过程

    一、安装步骤

    1. 下载需要的安装包,参考这里,点击右侧的Looking for previous GA versions来获取历史版本;
    2. 解压到一个你想安装的位置,比如我解压在这里,如图:


      image.png
    3. 在安装根目录里创建文件my.ini,并输入一下内容:
      [mysqld]
      character-set-server=utf8 # 5.7之后的编码设置方式有所改变
      port=3306
      basedir=D:/Programs/Mysql # 填写自己的MySQL安装根目录
      datadir=D:/Programs/Mysql/data # 设置数据存放目录
      max_connections=200
      default-storage-engine=INNODB
      
      [mysql]
      default-character-set=utf8
      
      [mysql.server]
      default-character-set=utf8
      
      [mysql_safe]
      default-character-set=utf8
      
      [client]
      port = 3306
      
    4. 初始化,以管理员身份运行如下指令,并记录在屏幕上显示的密码:
      mysqld --initialize --user=root --console
      
    5. 安装MySQL服务
      mysqld install MySQL --defaults-file="D:/Programs/Mysql/my.ini"
      
      • 如:
        C:\Windows\system32>mysqld --initialize --user=root --console
        2018-11-02T16:59:08.495420Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
        2018-11-02T16:59:11.516114Z 0 [Warning] InnoDB: New log files created, LSN=45790
        2018-11-02T16:59:12.155422Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
        2018-11-02T16:59:12.400617Z 0 [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: 9f63c807-dec0-11e8-a8bb-b82a72a418a4.
        2018-11-02T16:59:12.450101Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
        2018-11-02T16:59:12.463441Z 1 [Note] A temporary password is generated for root@localhost: .s&B_mmkj0o=
        
    6. 启动服务:
      net start MySQL
      
    7. 重置密码
      • 使用刚才记录的临时密码,在命令行利用mysql -u -p登录MySQL,然后输入密码;
      • 修改密码:
        • SET PASSWORD = PASSWORD('<new-password>');
        • ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
        • FLUSH PRIVILEGES;
      • exit退出重新登录即可;

    二、躺坑时间

    1. 启动服务的时候报错:
      A system error occurred 2. 
      The system cannot find the file specified. 
      
      • 解决方案:
        • 删除服务
          mysqld --remove # 不需要重启
          sc delete <service-name> # 需要重启,删服务通用
          
        • 管理员启动cmd,切换到MySQL安装的根目录中的bin中,重新执行安装服务的命令即可;
    2. 执行命令的时候要是报错缺少msvcp120.dll,就去安装Visual C++2013,或者网上搜索游戏常用运行库安装包,安装即可;

    参考

    1. https://www.programering.com/a/MTN2gjMwATY.html
    2. https://www.cnblogs.com/debmzhang/p/5013540.html

    相关文章

      网友评论

        本文标题:MySQL 5.7.24 绿色版安装手记

        本文链接:https://www.haomeiwen.com/subject/kzbhxqtx.html