• Mysql 5.7 for windows 免安装版(解压版)安装和配置


    网上写的不近详细,这里重新整理下。

    准备:

    1、windows操作系统

    2、mysql 的解压版压缩文件

    第一步:

    解压mysql的压缩包到你的安装目录,因为是虚拟机,这里我就安装在C盘下:C:mysql-5.7.18-win32

    第二步:

    配置环境变量

    在系统变量下找到Path这个值,

    点击编辑修改,

    后面添加的路径是mysql的安装路径+in,比如我的安装路径是 C:mysql-5.7.18-win32

    则需要添加的是 C:mysql-5.7.18-win32in

    注意:添加之前看结尾有没有分号,没有记得加分号再添加。

    第三步:

    进入mysql安装目录下的bin文件夹,安装mysql

    以管理员身份运行cmd,

    依次运行下列命令:

    1、cd C:mysql-5.7.18-win32in                   //进入安装目录下的bin文件夹

    2、mysqld --install                                    //安装mysqld服务

    3、配置my.ini文件

    1)需要你在安装目录下新建一个名为my.ini文件,.ini是后缀名。

    2)然后在安装目录下新建一个名为data的文件夹。

    如图:

    把下面代码复制到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]
    port = 3306
    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.
    character_set_server=utf8
    init_connect='SET NAMES utf8'
    basedir = C:mysql-5.7.18-win32       
    datadir = C:mysql-5.7.18-win32data
    port = 3306
    # server_id = .....
    
    
    # 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 

     注意:

    basedir = C:mysql-5.7.18-win32       //这里改成你自己的安装目录
    datadir = C:mysql-5.7.18-win32data   //改成 安装目录data    这个路径存放你的数据文件

     4、初始化mysql

    同样是在mysql安装目录下的bin文件夹内,

    执行下面命令:

    mysqld --defaults-file=C:mysql-5.7.18-win32my.ini --initialize --console

    运行结果如下:

    红框内是产生的随机密码,把它记录下来。待会登录mysql要用。

    5、启动并登录mysql

    依次运行下面命令:

    1)net start mysql

    2)mysql -u root -p

    要求你输入密码,把上面产生的随机密码输入,注意大小写。

    出现红框里的内容表示的登录成功。

    6、重设登录密码

    运行下面命令

    set password for root@localhost=password('123456');           //单引号里面是你自己的密码,可以改成你自己的密码

     

    出现如上图界面表示成功。

    7、用新密码重新登录(实验新密码对不对,这步也可以不用操作)

     OK,到这里已全部完事。

    人生如修仙,岂是一日间。何时登临顶,上善若水前。
  • 相关阅读:
    [2019 CSP-S赛前集训] [CF1037D] Valid BFS?
    [2019 CSP-S赛前集训] [洛谷P1613] 跑路
    [2019 CSP-S赛前集训] [洛谷P1967] 货车运输
    [洛谷博客] 我的洛谷博客内容搬运
    终于开通了博客
    Qt Creator 添加arm版本的qmake时的问题
    U盘挂载问题
    段错误解决办法
    printf %m
    使用pthread_create()创建线程
  • 原文地址:https://www.cnblogs.com/f-society/p/6902057.html
Copyright © 2020-2023  润新知