zoukankan      html  css  js  c++  java
  • mysql5.7.29 zip包安装教程

    下载zip包

    https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.29-winx64.zip

    解压安装包

    D:mysql-5.7.29-winx64mysql-5.7.29-winx64

    在根路径创建my.ini

    [mysql]
    # 设置mysql客户端默认字符集
    default-character-set=utf8
    [mysqld]
    #设置3306端口
    port = 3306
    # 设置mysql的安装目录
    basedir=D:mysql-5.7.29-winx64mysql-5.7.29-winx64
    # 设置mysql数据库的数据的存放目录
    datadir=D:mysql-5.7.29-winx64mysql-5.7.29-winx64data
    # 允许最大连接数
    max_connections=200
    # 服务端使用的字符集默认为8比特编码的latin1字符集
    character-set-server=utf8
    # 创建新表时将使用的默认存储引擎
    default-storage-engine=INNODB
    
    #跳过登录密码验证
    #skip-grant-tables
    

    设置环境变量

    MYSQL_HOME=D:mysql-5.7.29-winx64mysql-5.7.29-winx64

    Path添加 %MYSQL_HOME%in

    初始化数据库

    mysqld --initialize --user=root --console

    记住分配的密码

    C:Windowssystem32>mysqld --initialize --user=root --console
    2020-07-10T11:33:05.132085Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2020-07-10T11:33:05.481773Z 0 [Warning] InnoDB: New log files created, LSN=45790
    2020-07-10T11:33:05.502141Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
    2020-07-10T11:33:05.569979Z 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: 1f1c5e36-c2a1-11ea-bf6f-d45d644414dd.
    2020-07-10T11:33:05.571489Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
    2020-07-10T11:33:07.938169Z 0 [Warning] CA certificate ca.pem is self signed.
    2020-07-10T11:33:08.356279Z 1 [Note] A temporary password is generated for root@localhost: S!kllE;2eNO;

    安装mysql服务 

    #mysqld --install 服务名

    mysqld --install mysql

    登录

    mysql -uroot -pS!kllE;2eNO

    如果提示密码错误或忘记密码需要修改密码

    C:Windowssystem32>mysql -uroot -p
    Enter password: ***********
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    在my.ini中[mysqld] 添加 skip-grant-tables,表示跳过权限验证

    [mysql]
    # 设置mysql客户端默认字符集
    default-character-set=utf8
    [mysqld]
    #设置3306端口
    port = 3306
    # 设置mysql的安装目录
    basedir=D:mysql-5.7.29-winx64mysql-5.7.29-winx64
    # 设置mysql数据库的数据的存放目录
    datadir=D:mysql-5.7.29-winx64mysql-5.7.29-winx64data
    # 允许最大连接数
    max_connections=200
    # 服务端使用的字符集默认为8比特编码的latin1字符集
    character-set-server=utf8
    # 创建新表时将使用的默认存储引擎
    default-storage-engine=INNODB
    
    #跳过登录密码验证
    skip-grant-tables

    重启服务

    net stop mysql

    net start mysql

    mysql -uroot -p 直接回车登录

    重新设置密码:set password for root@localhost=password('root');

    如果报一下错误,则先刷新权限执行 flush privileges; 之后在执行 set password for root@localhost=password("新密码");

    mysql> set password for root@localhost=password('root');
    ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

    删除my.ini中最后一行添加 skip-grant-tables,并重启服务

    重新登录

    mysql -uroot -proot

    C:Windowssystem32>mysql -uroot -proot
    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 6
    Server version: 5.7.29 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2020, 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>
  • 相关阅读:
    MFC Windows 程序设计>WinMain 简单Windows程序 命令行编译
    AT3949 [AGC022D] Shopping 题解
    CF643D Bearish Fanpages 题解
    CF643C Levels and Regions 题解
    CF241E Flights 题解
    CF671C Ultimate Weirdness of an Array 题解
    CF1592F Alice and Recoloring 题解
    GYM 102452E 题解
    CF494C Helping People 题解
    P5556 圣剑护符
  • 原文地址:https://www.cnblogs.com/zincredible/p/13281028.html
Copyright © 2011-2022 走看看