配置my.ini文件
[client] port=3306 default-character-set=utf8 [mysqld] # 设置为自己MYSQL的安装目录 basedir=D:Program FilesMySQLMySQL Server 5.7-3306 # 设置为MYSQL的数据目录 datadir=D:Program FilesMySQLMySQL Server 5.7-3306data #设置3306端口 port=3306 # 服务端使用的字符集默认为8比特编码的latin1字符集 character_set_server=utf8 # 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES #开启查询缓存 explicit_defaults_for_timestamp=true skip-grant-tables
在dos命令下进入mysql的bin目录 ,执行
mysqld --install mysqld_3306 (重命名服务名是为了方便多实例安装)
mysqld --initialize
密码在后缀名为err的文件中
2019-09-02T12:43:21.832824Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2019-09-02T12:43:21.832824Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set. 2019-09-02T12:43:23.782828Z 0 [Warning] InnoDB: New log files created, LSN=45790 2019-09-02T12:43:24.344429Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2019-09-02T12:43:24.531629Z 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: 40ec5e78-cd7f-11e9-be0a-7c7a911e77d7. 2019-09-02T12:43:24.578429Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2019-09-02T12:43:24.609629Z 1 [Note] A temporary password is generated for root@localhost: xgylo1yich+V 2019-09-02T12:43:57.978088Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2019-09-02T12:43:57.978088Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set. 2019-09-02T12:43:57.978088Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 2019-09-02T12:43:57.978088Z 0 [Note] mysqld_3306 (mysqld 5.7.24) starting as process 4008 ... 2019-09-02T12:43:57.993688Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions 2019-09-02T12:43:57.993688Z 0 [Note] InnoDB: Uses event mutexes 2019-09-02T12:43:57.993688Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier 2019-09-02T12:43:57.993688Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 2019-09-02T12:43:57.993688Z 0 [Note] InnoDB: Number of pools: 1 2019-09-02T12:43:57.993688Z 0 [Note] InnoDB: Not using CPU crc32 instructions 2019-09-02T12:43:57.993688Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2019-09-02T
mysql 8.0.15 安装步骤有点差异 初始化使用
mysqld --initialize --console
密码会在控制台打印出来
首次登录需要修改密码,不然使用navicat会提示密码过期
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';