• MySQL8.0安装与使用


    Windows:

      1.下载:https://dev.mysql.com/downloads/mysql/

                   推荐使用镜像:http://mirrors.sohu.com/mysql/MySQL-8.0/

      2.下载完成之后, 解压到目录下,例如:D:mysql-8.0.22-winx64

      3. 设置环境变量

        变量名称:MYSQL_HOME

        变量值:D:mysql-8.0.22-winx64

      4. 生成data目录

              注意: 以管理员身份运行cmd

      进入到bin目录下D:mysql-8.0.22-winx64in

           执行命令:

    mysqld --initialize-insecure --user=mysql

      则会在bin目录的同级生成data目录

      5. 安装MySQL

       

    mysqld  -install

      6. 启动服务

    net start MySQL

      7. 登录MySQL

    mysql  -u root -p
    
    //默认没有设置密码, 直接回车即可

      8)查询用户密码

    select host,user,authentication_string from mysql.user

      9)密码修改

    use mysql;
    
    
    
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

    flush privileges;


      10)再次登录

      11)mysql配置

                默认mysql8.0是data目录中是不存在my.ini配置文件的,如有需要新建即可 

    # For advice on how to change settings please see
    # http://dev.mysql.com/doc/refman/5.6/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 = utf8mb4
    [mysql]
    default-character-set = utf8mb4
    [mysqld]
    character-set-client-handshake = FALSE
    character-set-server = utf8mb4
    collation-server = utf8mb4_bin
    init_connect='SET NAMES utf8mb4'
    # 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.
    basedir = D:mysql-8.0.22-winx64
    datadir = D:mysql-8.0.22-winx64data
    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 = 16M
    read_rnd_buffer_size = 16M 
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

            设置完成之后, 可以设置mysql默认的配置文件

    mysqld --defaults-file="D:mysql-8.0.22-winx64datamy.ini"

      然后重启服务即可, 如果你在开始安装的时候已经创建了配置文件,可以在安装的时候直接指定即可

    mysqld --install "MySql80" --defaults-file="C:installmysqlmysql-8.0.16-winx64my.ini"

    其他相关命令:

      1. 停止MySQL服务

    net stop  mysql
  • 相关阅读:
    Ext.form.TextField组件
    provider: SQL Network Interfaces, error: 26 Error Locating Server/Instance Specified解决办法
    SQL Server访问远程数据库和Linked Server
    C#程序实现动态调用DLL的研究
    把DLL文件打包进EXE的技巧
    C#读取媒体信息
    C# 集合类
    Server Application Unavailable 【Failed to execute request because the AppDomain could not be created.】的解决办法
    比较全的字符串验证类
    如何用VS2005制作Web安装程序
  • 原文地址:https://www.cnblogs.com/xingxia/p/mysql80.html
Copyright © 2020-2023  润新知