1、定位配置文件:mysqld --verbose --help |grep -A 1 'Default options'

2、修改配置文件:vi /etc/my.cnf

3、重启MySQL:service mysql restart

4、无密码登录MySQL:mysql -u root -p

5、 修改密码:ALTER USER 'root'@'localhost' IDENTIFIED BY 'Data-Insights123';

时间:2026-02-14 14:12:05
1、定位配置文件:mysqld --verbose --help |grep -A 1 'Default options'

2、修改配置文件:vi /etc/my.cnf

3、重启MySQL:service mysql restart

4、无密码登录MySQL:mysql -u root -p

5、 修改密码:ALTER USER 'root'@'localhost' IDENTIFIED BY 'Data-Insights123';
