最近登录MySQL时候总报错:

# mysql -uroot -p
  Enter password:
  ERROR (): Access denied for user 'root'@'localhost' (using password: YES)

我猜想是不是密码忘记了。。。然后准备修改密码:

#mysqladmin -u root -p password 123456     ###设置root密码为123456
  Enter password:
  mysqladmin: connect to server at 'localhost' failed
  error: 'Access denied for user 'root'@'localhost' (using password: YES)'

依然报这个错误。。。百度一下,最终找到了方法如下:

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

mysqladmin -u root -p password 123456有时候是好使的。。。

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

方法一:

# /etc/init.d/mysqld 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 -uroot -p 

  Enter password: <输入新设的密码newpassword> 

  mysql> 

方法二:

直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:

# mysql -udebian-sys-maint -p 

  Enter password: <输入[client]节的密码> 

  mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’; 

  mysql> FLUSH PRIVILEGES; 

  mysql> quit 

# mysql -uroot -p 

  Enter password: <输入新设的密码newpassword> 

  mysql> 

MySQL登录报错"Access denied for user 'root'@'localhost' (using password: YES)"的更多相关文章

  1. linux下mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”)的处理方法

    最近登录某台服务器的mysql时候总报错: Access[root@log01 ~]# mysql -u root -p Enter password: ERROR 1045 (28000): Acc ...

  2. mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”)的处理方法

    环境 CentosOS 6.5 ,已安装mysql 情景 root密码忘记,使用普通用户无法登录 解决 问题一 无法使用mysql命令 参考文章:https://www.cnblogs.com/com ...

  3. 最新 mysql登录报错“Access denied for user 'root'@'localhost' (using password: NO”的处理方法

    1.关闭正在运行的MySQL.2.打开DOS窗口,转到mysql\bin目录.3.输入mysqld --skip-grant-tables回车.如果没有出现提示信息,那就对了.(正常的情况是光标闪烁没 ...

  4. mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”的处理方法

    使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码: 文件内容: [client]host = localhostuser = debian-sys-maint ...

  5. 关于Linux下面msyql安装后并未设置初始密码,但是登录报错“Access denied for user 'root'@'localhost' (using password: NO)”的解决方案

    如上图:首先我安装mysql的时候并没有设置密码,但是就是登不进去,百度了一下,解决方案如下: 解决方案地址:http://zhidao.baidu.com/link?url=7QvuOKtfRdMT ...

  6. 008-MySQL报错-Access denied for user 'root'@'localhost' (using password: NO)

    1.新安装的mysql报错 MySQL报错-Access denied for user 'root'@'localhost' (using password: NO) 解决方案 1.先停掉原来的服务 ...

  7. 在MySQL登录时出现Access denied for user 'root'@'localhost' (using password: YES) 拒绝访问,并可修改MySQL密码

    这两天装了一个mysql 5.7数据库,但是在本地dos登陆不上去,报错Access denied for user 'root'@'localhost'(using password:YES): 也 ...

  8. 【转载】在MySQL登录时出现Access denied for user 'root'@'localhost' (using password: YES) 拒绝访问,并可修改MySQL密码

    在MySQL登录时出现Access denied for user 'root'@'localhost' (using password: YES) 拒绝访问,并可修改MySQL密码 2018年08月 ...

  9. 连接数据库报错Access denied for user 'root'@'localhost' (using password:YES)

    报错信息为:pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using pa ...

随机推荐

  1. MySQL监控工具-orztop

    先安装orzdba,链接:http://blog.itpub.net/28939273/viewspace-1875895/ 安装依赖的包:[root@hank-yoon servers]# yum ...

  2. IOS中Retain和Copy的区别

    1 ,可读性: readonly  . readwrite@property(readwrite,....) valueType value;这个属性是变量的默认属性,就是如果你 (readwrite ...

  3. iOS:等比压缩截图代码

    将一幅图片按着需要的尺寸进行等比的压缩和放大,最后再截取需要尺寸部分,不知道说清楚没,反正就那意思吧! +(UIImage *)compressImageWith:(UIImage *)image w ...

  4. iOS 进阶 第十三天(0414)

    0414 画线.圆和圆弧的第二种方法 5中方法画矩形: 第二种画图形的方法: 之前做的方法都是先把要画的元素缓存到图形上下文CGConteextRef中去,现在第二种方法也缓存到CGPath中去.其实 ...

  5. sharepoint 2010

    Technical diagrams (SharePoint Server 2010) http://technet.microsoft.com/en-us/library/cc263199(offi ...

  6. NET免费服务器

    NET免费服务器 1.先注册一个号.地址:https://appharbor.com/ 2.看看有没有你需要的插件,基本上都是免费的 3.本地创建git库 4.复制git远程仓库的地址 5.推送到远程 ...

  7. android聊天,存储聊天记录sqlite

    项目中有聊天模块,需要用到打开activity的时候初始化聊天记录的情况.大致情况如下: 辅助类:ChatSQLiteHelper   在第一次时会调用oncreate方法(判断的标准是schedul ...

  8. cadence16.6 中orcad导出网表时ERROR (ORCAP-5004)

    ORCAD网表输出时 ERROR (ORCAP-5004):Error  initializing COM  property   pages 之前遇到过这个问题,解决后忘了记录下来了.依稀记得问题答 ...

  9. myeclipse trial expired[转]

    转自:http://blog.csdn.net/yuyuyuyuy/article/details/5878122 今天MyEclipse提示过期了,MyEclipse Trial Expired. ...

  10. 2064: 分裂 - BZOJ

    Description 背景: 和久必分,分久必和... 题目描述: 中国历史上上分分和和次数非常多..通读中国历史的WJMZBMR表示毫无压力. 同时经常搞OI的他把这个变成了一个数学模型. 假设中 ...