繁体   English   中英

我在 ubuntu 上使用命令 sudo mysql 收到 ERROR 1045 (28000): Access denied for user 'root'@'localhost'(使用密码:NO)

[英]I got ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) with the command sudo mysql on ubuntu

我真的是 php 或 sql 之类的所有东西的菜鸟,所以我参加了一个 coursera 课程,他们告诉我们安装 LAMP。

我有 Linux 和 Apache2 但对于 MySql,我按照本教程如何安装 LAMP 我跟着它,在我们必须运行sudo mysql的地方之后,我收到ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 但根据教程我应该得到:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 8.0.19-0ubuntu5 (Ubuntu)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

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> 

请任何人尽快帮助我,因为我正在做的课程有截止日期。 此外,如果网络上有任何可用的文档,请分享。

如果您需要有关错误的更多信息,请告诉我以及如何提取它们。

谢谢你。

编辑:我的问题解决了,我可以在运行mysql -u root -p后输入密码

嗨,在您的 mysql 控制台中尝试以下命令

mysql>  FLUSH PRIVILEGES;
mysql>  ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM