当前位置: 首页 > news >正文

Navicat连接MySQL-出现1045无法连接问题

问题背景:安装完MySQL和Navicat后,在命令行终端输入密码,总是报错;但可以无密码进入MySQL命令行。与此同时,用Navicat连接MySQL时,输入密码,显示无法连接【前提:密码输入正确】在这里插入图片描述

win+R,命令行终端报错代码如下:

C:\Users\lenovo>mysql -u root -p 111111
Enter password: ******
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)

C:\Users\lenovo>mysql -u root -p
Enter password: ******
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)

C:\Users\lenovo>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 9.3.0 MySQL Community Server - GPL

Copyright © 2000, 2025, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

解决办法:

  1. 修改 MySQL 用户密码
    首先,确保 ‘root’ 用户有一个强密码,并且这个密码在 Navicat 中也被正确输入。
    登录 MySQL 命令行(无需密码):
mysql -u root

2.更新 ‘root’ 用户的密码:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

将 new_password 替换为你想要设置的新密码。
3.刷新权限,使更改生效:

FLUSH PRIVILEGES;

4.退出 MySQL:

exit;

5.输入密码,重新连接,就能连上了
在这里插入图片描述

在这里插入图片描述

http://www.dtcms.com/a/346177.html

相关文章:

  • AI实验管理神器:WandB全功能解析
  • 【python】os.mkdir() 和 os.makedirs()区别
  • 数学建模-灰色关联分析
  • map_set
  • Trie 树(字典树)
  • Rust 入门 注释和文档之 cargo doc (二十三)
  • 51单片机-中断系统
  • 【数据分享】各省及全国GDP增长指数(1980-2022)
  • 彻底解决 Windows 文件扩展名隐藏问题,注册表修改显示文件后缀方法
  • More Effective C++ 条款01:仔细区别 pointers 和 references
  • 构建城市数字孪生底座:深度解析智慧城市全景视频拼接融合解决方案
  • constraint_mode使用
  • 【Python】两条命令永久切国内源
  • Android 16环境开发的一些记录
  • C语言中的CSI_START和CSI_END宏
  • 拿到手一个前端项目,应该如何启动
  • 多目标跟踪中基于目标威胁度评估的传感器控制方法复现
  • lanczos算法学习笔记
  • 【GM3568JHF】FPGA+ARM异构开发板 测试命令
  • OFD格式文件及Python将PDF转换为OFD格式文件
  • Informer参数代码
  • SPI的DMA方式
  • 线性回归:从原理到实战的完整指南
  • ROS中的自定义消息
  • Windows 11 安装 Miniforge,配置国内源
  • 基层医疗遇到了什么问题?
  • 【spring security】权限管理组件执行流程详解
  • centos7安装oracle19c流程(自用)
  • Highcharts 推出适用于 Svelte 的官方集成库
  • 【软考架构】关系数据库