1、解压文件
例如:置于D:\Program Files\mysql-5.7.24-winx64,新建my.ini ,内容如下:
[mysqld]
# 设置为自己MYSQL的安装目录
basedir=E:\Program Files\mysql-5.7.24-winx64
# 设置为MYSQL的数据目录
datadir=E:\Program Files\mysql-5.7.24-winx64\data
port=3306
character_set_server=utf8
sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER
#开启查询缓存
explicit_defaults_for_timestamp=true
#skip-grant-tables
2、cmd管理员身份打开
定位到E:\Program Files\mysql-5.7.24-winx64\bin下,执行命令:
mysqld -install
3、获取初始密码
执行命令:
mysqld --initialize --user=mysql --console
记录末尾的密码,初次登陆时使用,例如:root@localhost: 7tet9sXdpa#V
2024-06-04T03:58:44.335792Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2024-06-04T03:58:45.027862Z 0 [Warning] InnoDB: New log files created, LSN=45790
2024-06-04T03:58:45.053269Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2024-06-04T03:58:45.168345Z 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: bd4b0f97-2226-11ef-b269-5405db68efe3.
2024-06-04T03:58:45.174894Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2024-06-04T03:58:45.221602Z 1 [Note] A temporary password is generated for root@localhost: 7tet9sXdpa#V
4、登录后修改密码
mysql -uroot -p
set password for root@localhost = password('123456');
网友评论