search
HomeDatabaseMysql TutorialERROR 1045 (28000): Access denied for user 'root&

在centos下,新搭建的mysql环境,直接输入mysql命令,提示如下错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 老师说是权限问题,随后在网上找到解决方法,粘贴在此,以备后用 --------------------------------

在centos下,新搭建的mysql环境,直接输入mysql命令,提示如下错误

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


老师说是权限问题,随后在网上找到解决方法,粘贴在此,以备后用

---------------------------------------------------------------------------------------------------------------------------------------------

mysql -uroot -p
输入设置的密码
竟然报错了!
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YSE)
初始密码是空的,可我设置了密码的阿。
密码留空
还是错误!
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
于是重改密码!
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysqld restart
# mysql -u root -p
Enter password: 
mysql>
搞定!

-----------------------------------------------------------------------------------------------------------------------------------------------

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
PHP Fatal error: Call to undefined method PDO::prepare() in的解决方法PHP Fatal error: Call to undefined method PDO::prepare() in的解决方法Jun 22, 2023 pm 06:40 PM

PHP作为一种流行的Web开发语言,已经被使用了很长时间。PHP中集成的PDO(PHP数据对象)类是我们在开发Web应用程序过程中与数据库进行交互的一种常用方法。但是,一些PHP开发者经常遇到的问题是,当使用PDO类与数据库进行交互时,他们会收到这样的错误:PHPFatalerror:CalltoundefinedmethodPDO::prep

解决C++代码中出现的“error: incomplete type is not allowed”问题解决C++代码中出现的“error: incomplete type is not allowed”问题Aug 26, 2023 pm 08:54 PM

解决C++代码中出现的“error:incompletetypeisnotallowed”问题在C++的编程过程中,有时候会遇到一些编译错误,其中一个常见的错误是“error:incompletetypeisnotallowed”。这个错误通常是由于在使用不完整的类型进行操作时引起的。本文将介绍这个错误的原因,并提供几种解决方法。首先,我

在Vue应用中使用axios时出现“Uncaught (in promise) Error: Request failed with status code 500”怎么办?在Vue应用中使用axios时出现“Uncaught (in promise) Error: Request failed with status code 500”怎么办?Jun 24, 2023 pm 05:33 PM

在Vue应用中使用axios是十分常见的,axios是一种基于Promise的HTTP客户端,可以用于浏览器和Node.js。在开发过程中,有时会出现“Uncaught(inpromise)Error:Requestfailedwithstatuscode500”的错误提示,对于开发者来说,这个错误提示可能有些难以理解和解决。本文将会探讨这

0271:real time clock error开不开机怎么办0271:real time clock error开不开机怎么办Mar 13, 2023 am 11:30 AM

“0271:real time clock error”开不开机的解决办法:1、按一下F1,在出现的界面中,将选项栏转到第三项“Date/Time”;2、将系统时间手动修改成现在的时间;3、按F10,在弹出的对话框中,选择yes;4、重新打开笔记本即可正常开机。

解决C++代码中出现的“error: expected initializer before 'datatype'”问题解决C++代码中出现的“error: expected initializer before 'datatype'”问题Aug 25, 2023 pm 01:24 PM

解决C++代码中出现的“error:expectedinitializerbefore'datatype'”问题在C++编程中,有时候我们在编写代码时会遇到一些编译错误,其中一种常见的错误是“error:expectedinitializerbefore'datatype'”。这个错误通常在变量声明或函数定义中发生,可能导致程序无法正确编译或

如何解决PHP Warning: fopen(): failed to open stream: No such file or directory如何解决PHP Warning: fopen(): failed to open stream: No such file or directoryAug 19, 2023 am 10:44 AM

如何解决PHPWarning:fopen():failedtoopenstream:Nosuchfileordirectory在使用PHP开发过程中,我们经常会遇到一些文件操作的问题,其中之一就是"PHPWarning:fopen():failedtoopenstream:Nosuchfileordirectory

microsoft access是什么软件microsoft access是什么软件Mar 03, 2023 am 11:37 AM

microsoft access是由微软发布的关系数据库管理系统;它结合了MicrosoftJet Database Engine和图形用户界面两项特点,是Microsoft Office的系统程序之一。

PHP Fatal error: Call to undefined function mysqli_connect()的解决方法PHP Fatal error: Call to undefined function mysqli_connect()的解决方法Jun 23, 2023 am 09:40 AM

在使用PHP编写Web应用程序时,经常会使用MySQL数据库来存储数据。PHP提供了一种与MySQL数据库进行交互的方法,称为MySQLi。然而,有时在使用MySQLi时,会遇到一个错误信息,如以下所示:PHPFatalerror:Calltoundefinedfunctionmysqli_connect()这个错误信息意味着PHP无法找到my

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor