标签搜索

Win7/10安装zip版本MySQL8.0数据库方法

basil
2019-09-20 / 253 阅读
  1. 到官网mysql8.0下载zip文件,解压到指定目录
  2. 配置系统环境变量到bin目录下
  3. 在根目录下创建my.ini文件,并输入配置信息

    [mysqld]
    # 服务端端口
    port=3306
    # mysql安装路径
    basedir=F:\webserver\mysql8.0
    # mysql数据库存储路径
    datadir=F:\webserver\mysql8.0\data
    # 最大连接数
    max_connections=200
    # 错误数量
    max_connect_errors=10
    # 服务端字符编码
    character-set-server=utf8
    # 数据库引擎
    default-storage-engine=INNODB
    # 验证方式
    default_authentication_plugin=mysql_native_password
    #运行模式
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
    
    #log-bin=mysql-bin
    #log-bin = "E:\mysql\logbin.log" # 自定义目录,日志保存路径
    #log-bin-index = "E:\mysql\logindex.index" # 自定义目录,日志保存路径
    #log-bin=ON
    #log_bin=D:\webserver\mysql_bin_log\log-bin
    #binlog_cache_size=32m
    #max_binlog_cache_size=512m
    #max_binlog_size=512m
    # binary logging format - mixed recommended
    #binlog_format=mixed
    #OGG同步必须指定日志为row
    #binlog_format=row
    # The maximum amount of concurrent sessions the MySQL server will
    # allow. One of these connections will be reserved for a user with
    # SUPER privileges to allow the administrator to login even if the
    # connection limit has been reached.
    
    [mysql]
    # 客户端字符编码
    default-character-set=utf8
    [client]
    # 客户端端口
    port=3306
    default-character-set=utf8
  4. 打开cmd命令行,输入mysqld --initialize
    --console进行初始化,记住生成的随机密码。如果不需要生成生成随机密码,将--initialize参数改为--initialize-insecure
  5. 安装mysql系统服务,输入命令mysqld install ,如果需要安装特殊的服务名,例如mysql8,则输入mysqld install mysql8进行安装
  6. 启动服务,输入命令net start mysql 进行启动
  7. 登录mysql,如果使用安全模式则输入mysql -uroot -p ,接着输入随机密码,如果使用非安全模式则输入mysql
    -uroot -p --skip-password进行连接
  8. 更改初始密码ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
0