MySQL访问拒绝root用户

发布于 2025-01-25 04:22:40 字数 274 浏览 3 评论 0原文

x86_64上的linux(((ubuntu))上安装了MySQL *VER 8.0.28-0ubuntu0.20.04.3((Ubuntu))

我最近在

错误1045(28000):访问用户'root'@'localhost'(使用 密码:否)

无论有没有Sudo,我都知道这在堆栈和其他论坛上都有答案,但是似乎没有帮助我,我尝试重新安装MySQL Server,但这也无济于密码,但这也失败了,需要帮助,谢谢

i have recently installed MySQL *Ver 8.0.28-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))*

after installation when i try to access my shell its showing

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using
password: NO)

both with or without sudo, i know this has answers on stack and other forums but none seems to help me, i have tried reinstalling MySQL server but that also didn't help, i tried skip grant option and then changing root password but that failed as well , need help in this , thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云胡 2025-02-01 04:22:40

您可以使用一个停机时间重置密码。只需按照8个版本的以下步骤即可。

  1. 停止MySQL服务
    $ SystemCtl停止MySQL
  2. 现在使用Skip Grant表模式运行MySQL服务。
    $ mysqld_safe- -skip-grant-tables&
  3. 现在登录服务
    $ mysql -uroot
  4. 执行flush特权查询
  5. 执行Alter查询
    $ Alter用户'root'@'localhost'由“密码”标识;
  6. 现在停止MySQL服务
    $ SystemCtl停止MySQL
  7. 现在重新启动MySQL服务
    $ Systemctl重新启动MySQL
  8. 现在尝试使用更新的密码登录

You can reset the password with one downtime. Just simply follow the below steps for 8 version.

  1. Stop the Mysql service
    $ systemctl stop mysql
  2. Now run Mysql service with skip grant tables mode.
    $ mysqld_safe --skip-grant-tables &
  3. Now login the service
    $ mysql -uroot
  4. execute flush privileges query
  5. execute alter query
    $ alter user 'root'@'localhost' identified by 'password';
  6. Now stop the mysql service
    $ systemctl stop mysql
  7. now restart the mysql service
    $ systemctl restart mysql
  8. Now try to login using the updated password
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文