bash, sudo systemctl stop mysql,
`,,2. 启动MySQL到安全模式:,
`bash, sudo mysqld_safe --skip-grant-tables &,
`,,3. 登录MySQL:,
`bash, mysql -u root,
`,,4. 切换到MySQL数据库并更新root密码:,
`sql, USE mysql;, UPDATE user SET authentication_string=PASSWORD('新密码') WHERE User='root';, FLUSH PRIVILEGES;,
`,,5. 退出MySQL并重启MySQL服务:,
`bash, exit, sudo systemctl start mysql,
`,,请将
新密码`替换为你想要设置的密码。lsof -i :端口号
来查询指定端口的进程占用情况。要查询8080端口的占用情况,可以使用命令lsof -i :8080
。Powered By Z-BlogPHP 1.7.3