zoukankan      html  css  js  c++  java
  • MySQL 8 配置文件

    包括功能:

    端口,是否启用bin log , 指定目录, InnoDB是否启用压缩,MySQL使用旧的密码验证方式.

    说明,建表的时候要添加必要的参数才会启用表数据压缩存储,以下为例:

    CREATE TABLE `win008` (
      `id` int(11) DEFAULT NULL,
      `name` char(50) DEFAULT NULL,
      `note` varchar(255) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4

     关于初始化安装,请参考 http://www.cnblogs.com/laumians-notes/p/9069498.html 不再累赘 .

    [mysqld]
    #是否启用bin log
    skip-log-bin
    
    # 设置3306端口
    port=3306
    # 设置mysql的安装目录
    basedir=D:\webserver\mysql\mysql-8.0.12-winx64
    # 切记此处一定要用双斜杠\,单斜杠我这里会出错
    # 设置mysql数据库的数据的存放目录
    datadir=D:\webserver\mysql\data\mysql8
    # 允许最大连接数
    max_connections=20
    # 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
    max_connect_errors=10
    # 服务端使用的字符集默认为UTF8
    character-set-server=utf8mb4
    
    # 默认使用“mysql_native_password”插件认证
    default_authentication_plugin=mysql_native_password
    
    #InnoDB#
    # 创建新表时将使用的默认存储引擎
    default-storage-engine=INNODB
    innodb_buffer_pool_size=2G
    #innodb_additional_pool_size=20M
    innodb_log_file_size=256M
    innodb_log_buffer_size=12M
    innodb_flush_log_at_trx_commit=2
    #innodb_flush_method
    #thread_cache=8
    #innodb_autoextend_increment=128M
    
    #这里确认是否起用压缩存储功能
    innodb_file_per_table=1
    #innodb_file_format=barracuda #mysql 8 不支持该功能
    #决定压缩程度的参数,如果你设置比较大,那么压缩比较多,耗费的CPU资源也较多;
    #相反,如果设置较小的值,那么CPU占用少。默认值6,可以设置0-9#
    innodb_compression_level=6
    #指定在每个压缩页面可以作为空闲空间的最大比例,
    #该参数仅仅应用在设置了innodb_compression_failure_threshold_pct不为零情况下,并且压缩失败率通过了中断点。
    #默认值50,可以设置范围是0到75
    innodb_compression_pad_pct_max=50
    
    [mysql]
    # 设置mysql客户端默认字符集
    default-character-set=utf8
    [client]
    # 设置mysql客户端连接服务端时默认使用的端口
    port=3306
    default-character-set=utf8

    接下来初始化数据环境:

    mysqld --initialize --user=mysql --console

    大概会得到如下结果:

    C:UsersAdministrator>mysqld --initialize --user=mysql --console
     100 200
     100 200
    2019-04-20T14:41:31.854709Z 0 [System] [MY-013169] [Server] C:mysql-8.0.15-winx
    64inmysqld.exe (mysqld 8.0.15) initializing of server in progress as process
    13720
    2019-04-20T14:42:13.645099Z 5 [Note] [MY-010454] [Server] A temporary password i
    s generated for root@localhost: F-/Yn%lhd3,K
    2019-04-20T14:42:24.641728Z 0 [System] [MY-013170] [Server] C:mysql-8.0.15-winx
    64inmysqld.exe (mysqld 8.0.15) initializing of server has completed

    从中可以得到初始化数据的root的密码,接下来继续安装和启动服务:

    C:UsersAdministrator>mysqld --install
    Service successfully installed.
    
    C:UsersAdministrator>net start mysql
    MySQL 服务正在启动 ....
    MySQL 服务已经启动成功。

    登录并修改原始密码:

    C:UsersAdministrator>mysql -uroot -p
    Enter password: ************
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 11
    Server version: 8.0.15
    
    Copyright (c) 2000, 2019, 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> ALTER USER "root"@"localhost" IDENTIFIED  BY "123456";
    Query OK, 0 rows affected (0.40 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
  • 相关阅读:
    【bzoj1408】 Noi2002—Robot
    【bzoj3884】 上帝与集合的正确用法
    【bzoj2190】 SDOI2008—仪仗队
    【uoj264】 NOIP2016—蚯蚓
    【uoj262】 NOIP2016—换教室
    【uoj261】 NOIP2016—天天爱跑步
    python sort 和sorted排序
    mkdir: cannot create directory ‘/soft/hadoop-2.7.3/logs’: Permission denied问题
    RuntimeError: implement_array_function method already has a docstring
    flask 的orm
  • 原文地址:https://www.cnblogs.com/equation/p/9443097.html
Copyright © 2011-2022 走看看