Mysql8.0用户密码正确无法登陆解决方案

问题描述

突然要用到mysql workbench管理数据库,输入密码无法进入,命令行启动mysql服务也失败。

切换到mysql安装目录下的bin目录:

输入:

net start mysql

提示无法启动,没有详细错误日志。

stop服务也失败。

解决方案:

在mysql的bin目录下输入命令:

mysqld --initialized --console

查询错误原因如下:

 我的原因是端口3306被其他的服务占用

管理员方式打开新的cmd,查询3306端口:

netstat -aon|findstr 3306

如下图结果,3306端口被进程5324占用,打开任务管理器,找到进程号PID为5324的进程并结束该进程。

再次用上述命令查询3306端口,如下图已被杀死

返回mysql的bin目录:

启动mysql 

参考链接:MySQL8.0解决“MySQL 服务无法启动。 服务没有报告任何错误。” - 计数寄存器 - 博客园 (cnblogs.com)

  • 8
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您好,关于 Spring Boot 连接 MySQL 8.0 出现密码正确的问题,可能有以下几种原因和解决方案: 1. MySQL 8.0 默认使用了新的密码加密方式,需要在连接字符串中添加加密方式参数。可以在 application.properties 或 application.yml 中添加以下配置: ``` spring.datasource.url=jdbc:mysql://localhost:3306/dbname?useSSL=false&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true&verifyServerCertificate=false&allowMultiQueries=true&useAffectedRows=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' spring.datasource.username=root spring.datasource.password=yourpassword spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/dbname?useSSL=false&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true&verifyServerCertificate=false&allowMultiQueries=true&useAffectedRows=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION'&password=${spring.datasource.password}&jdbcCompliantTruncation=false&useInformationSchema=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC ``` 2. 如果您仍然无法连接到 MySQL,请确保您在 MySQL正确设置了用户名和密码,以及授予了正确的权限。 3. 如果您使用的是 Spring Security,可能需要在 Security 配置中添加以下代码,以允许使用 MySQL 8.0 的加密方式: ``` @Bean public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); } ``` 希望以上解决方案能够帮助您解决问题。如果还有其他问题,请随时向我提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值