zoukankan      html  css  js  c++  java
  • mysql 5.7压缩包安装笔记

    转载请注明出处http://www.cnblogs.com/havedream/p/5075263.html

    重装系统之后准备安装mysql,看到官网上有mysql 5.7.10可以下载就点了,然后就开始了漫长的安装路程,总共折腾差不多一个多小时,最后终于安装成功了,这里把安装过程写下来,给自己做个笔记,也给后来人一个安装提示.

      1.下载安装包

      直接点击或者复制之后就可以下载了,不嫌麻烦或者想体验其他版本的也可以去官网下载,但是请注意,笔记只在5.7.10这个版本下运行成功,其他版本(仅供参考)需要参考官方的安装文档!

      http://120.192.95.132/cache/dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10-winx64.zip?ich_args=33a24030fa5191a36f50adaf2a0329c5_1_0_0_5_9c71accd314cb3f9f9f6e66f07ef13e42dd4f7c2bf4ea27f34b88c04e33f0945_80de45f03e1c6ffbe40617244bdec41b_1_0&ich_ip=

      2.解压缩文件夹到本地磁盘

      我把文件放在了

    C:Program_Filesmysql-5.7.10-winx64

      3.复制my-default.ini为my.ini

    建议复制一份,或者直接把my-default.ini重命名为my.ini

      4.填写my.ini相关内容

    basedir=C:Program_Filesmysql-5.7.10-winx64
    datadir=C:Program_Filesmysql-5.7.10-winx64data
    port=3306

    路径请替换成自己实际路径!

      5.环境变量

     新增环境变量,如下图

    修改path,注意是修改,增加的是后面我选中的部分

    %MYSQL_HOME%in;

      6.管理员权限运行[命令提示符]

    尽量使用管理员权限运行,否则,可能出现无法安装或者无法启动服务等问题!

      7.执行mysql初始化data

    mysqld --initialize --console

    结果如下:

    C:Windowssystem32>mysqld --initialize --console
    2015-12-25T03:01:33.140732Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2015-12-25T03:01:33.140732Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
    2015-12-25T03:01:33.140732Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
    2015-12-25T03:01:34.614085Z 0 [Warning] InnoDB: New log files created, LSN=45790
    2015-12-25T03:01:34.775606Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
    2015-12-25T03:01:34.872089Z 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: ceb98c90-aab3-11e5-8ca7-b870f4733564.
    2015-12-25T03:01:34.872089Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
    2015-12-25T03:01:34.891376Z 1 [Note] A temporary password is generated for root@localhost: +>><=Gs,0spF

    请注意,最后一句包含我们所需要的初始化密码!!!!

       8.安装mysql服务,并启动

    C:Windowssystem32>mysqld -install
    Service successfully installed.
    
    C:Windowssystem32>net start mysql
    MySQL 服务正在启动 .
    MySQL 服务已经启动成功。

      9.登录mysql并修改密码

    请注意,我下面的密码和上面的那个初始化密码不一样了,因为我有重新卸载了服务然后重新执行了一遍 7和8 ,因为上面的密码提示我无法登录,"<"无法识别!!!不知道有没有人知道是为什么?难道随机的密码太随机了?

    C:Windowssystem32>mysql -uroot -pih.sQWazK9*7
    mysql>  set password for 'root'@'localhost'="你的密码";
    Query OK, 0 rows affected (0.00 sec)

    好了,现在退出

    mysql> exit
    Bye

      10.修改远程登录

    到上面9 的时候本机已经可以正常使用mysql的功能了,不过如果需要远程登录mysql的话需要下面的设置

    C:Windowssystem32>mysql -uroot -p你的密码
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 3
    Server version: 5.7.10 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql> use mysql
    Database changed
    mysql> select host,user from user;
    +-----------+-----------+
    | host      | user      |
    +-----------+-----------+
    | localhost | mysql.sys |
    | localhost | root      |
    +-----------+-----------+
    2 rows in set (0.00 sec)
    
    mysql> update user set host='%' where user = 'root';
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    mysql> select host,user from user;
    +-----------+-----------+
    | host      | user      |
    +-----------+-----------+
    | %         | root      |
    | localhost | mysql.sys |
    +-----------+-----------+
    2 rows in set (0.00 sec)
    
    mysql>

    好了,到这里全部完成了,开始你的mysql之旅吧!

    转载请注明出处http://www.cnblogs.com/havedream/p/5075263.html

  • 相关阅读:
    docker-compose写法收集
    【CodeForces】704 C. Black Widow 动态规划+模拟
    【BZOJ】2693: jzptab 莫比乌斯反演
    【BZOJ】2154: Crash的数字表格 莫比乌斯反演
    【CodeForces】915 G. Coprime Arrays 莫比乌斯反演
    【CodeForces】915 F. Imbalance Value of a Tree 并查集
    【CodeForces】915 E. Physical Education Lessons 线段树
    【CodeForces】915 D. Almost Acyclic Graph 拓扑排序找环
    【Atcoder】AGC 020 B
    【Atcoder】AGC 020 D
  • 原文地址:https://www.cnblogs.com/havedream/p/5075263.html
Copyright © 2011-2022 走看看