zoukankan      html  css  js  c++  java
  • windows mysql8 安装

    下载
    MySQL Community下载地址:https://dev.mysql.com/downloads/mysql/
    MySQL Workbench下装地址:https://dev.mysql.com/downloads/workbench/
     
    安装
    1.官网下载,下载地址:https://dev.mysql.com/downloads/mysql/
    2.解压下载的zip文件到指定路径下,例如解压到:E:\mysql8025
    3.在mysql8025目录下创建my.ini文件,内容配置如下:

     注意:basedir为mysql安装根目录;datadir为数据存放目录。根据自己情况填写此值

    # 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
    port = 3306
    [mysql]
    default-character-set = utf8mb4
    [mysqld]
    character-set-client-handshake = FALSE
    character-set-server = utf8mb4
    collation-server=utf8mb4_unicode_ci
    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 = E:\mysql8025
    datadir = E:\mysql8025\data
    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
    4.使用管理员身份打开CMD,并进入到mysql安装bin目录下,执行初始化操作
    注意:1.mysql8025为自己添加的mysql服务名称 2.执行成功后会自动生成一个随机密码,请记录这个用于更改密码,如下图:

    mysqld --initialize --user=mysql8025 --console  

     

    5.安装数据库服务
    注意:mysql8025为服务名称,不填写则默认安装为MySQL

    mysqld --install mysql8025
    6.启动数据库服务
    注意:mysql8025为服务名称,关闭服务则为net stop mysql8025

     

    7.使用root权限登录数据库,会提示输入密码,这里将上面第4步默认生成的密码填写进来回车即可

    mysql -u root -p
    下面命令为端口非默认端口的登录语句,只要端口设置的不是3306端口,则用下面的语句登录。注意:-P后面跟的是端口号

    mysql -P3307 -uroot -p

     

    8.更改密码

     注意:Yxmysql8025.为mysql密码,根据自己情况填写此值

    ALTER USER root@localhost IDENTIFIED  BY 'Yxmysql8025.';

     

    更改MySQL外部访问

    选中mysql数据库,执行如下sql语句,如下图,然后将user值为root的host值改为%,然后重启数据库服务

    use mysql; #一定要写上这句 不然在管理工具中可能不显示mysql库导致下面的语句查询失败
    select * from user;

    安装工作就完成了,剩下的就是直接使用连接工具连接mysql即可。

  • 相关阅读:
    Quartz.Net进阶之一:初识Job作业和触发器
    Sql Server 三个很有用的函数
    Quartz.NET快速入门指南
    VS2015 提示 无法启动 IIS Express Web 服务器
    sql like 另一个表的字段
    Python3快速入门--Python多线程编程
    seo-网站变化百度搜索引擎的影响
    Asp.NetCore 3.1 EFCore处理Mysql的分库分表--MyCat解决方案
    asp.net core 3.1里 EF的事务-代码示例
    Asp.netCore3.1 Blazor入门
  • 原文地址:https://www.cnblogs.com/pfwbloghome/p/15581186.html
Copyright © 2011-2022 走看看