-- 环境变量
MYSQL_HOME
%MYSQL_HOME%\bin
-- 新增配置文件
my.ini
[mysqld]
port = 3306
basedir = D:/develop/MySQL/mysql-5.7.44-winx64
datadir = D:/develop/MySQL/mysql-5.7.44-winx64/data
max_connections = 200character-set-server=utf8
default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES[client]
default-character-set=utf8
-- 以管理员身份打开 cmd 或 powershell
mysqld –install
mysqld --initialize --user=root --console
-- 输出的最后一行的最后是初始化密码
2024-11-12T05:41:04.867168Z 1 [Note] A temporary password is generated for root@localhost: l)f2orgqKeOd
--
net start mysql
-- 修改初始化密码
mysql -u root -p
l)f2orgqKeOd
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
mysql> FLUSH PRIVILEGES;
mysql> quit;
mysql -u root -p