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

Linux:

MySQL安装时默认的用户是root,这里的root是指数据库的用户,root密码一般在初始化MySQL时存放在你的日志文件中,日志文件的存放路径可以通过my.cnf文件进行自定义。

使用如下方法即可解决,已验证可行。

#1.停止mysql数据库
/etc/init.d/mysqld stop #2.执行如下命令
mysqld_safe --user=mysql --skip-grant-tables --skip-networking & #3.使用root登录mysql数据库
mysql -u root mysql #4.更新root密码
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
#最新版MySQL请采用如下SQL:
mysql> UPDATE user SET authentication_string=PASSWORD('newpassword') where USER='root'; #5.刷新权限
mysql> FLUSH PRIVILEGES; #6.退出mysql
mysql> quit #7.重启mysql
/etc/init.d/mysqld restart #8.使用root用户重新登录mysql
mysql -uroot -p
Enter password: <输入新设的密码newpassword>

Mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)的更多相关文章

  1. 解决mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO/YES)

    一.问题 有时候我们登录Mysql输入密码的时候,会出现这种情况 mysql -u root -p Enter Password > '密码' 错误:ERROR 1045 (28000): Ac ...

  2. mysql登录报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    在MySQL登录时出现Access denied for user 'root'@'localhost' (using password: YES) 拒绝访问 对于出现拒绝访问root用户的解决方案错 ...

  3. win10连接mysql提示:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    win10中cmd连接mysql提示:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YE ...

  4. Ubuntu下 MySQL的“ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)”

    今天闲来无事,在Ubuntu上掏鼓一下mysql.但尴尬的是,当我输入mysql -u root -p的时候,抛出了一个错误:ERROR 1045 (28000): Access denied for ...

  5. 【MySQL】ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    问题现象: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 拒绝访问root用户 ...

  6. Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    案例环境: 操作系统 :Red Hat Enterprise Linux Server release 5.7 (Tikanga) 64 bit 数据库版本 : Mysql 5.6.19 64 bit ...

  7. Ubuntu下MySQL报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    在Ubuntu下 想要登录mysql数据库 root@JD:~# mysql -uroot -p 报错 ERROR 1045 (28000): Access denied for user 'root ...

  8. Win7下mysql root账户登录提示:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)解决方案

    ERROR 1045 (28000): Ac-- password: YES)这个意思是密码不正确,那就修改密码: 如果你是服务器是 windows xp/2000/2003/nt 都可以使用这个方法 ...

  9. Mysql修改root用户密码 For Mac 报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    环境 Mysql版本:5.7.12 操作系统:OSX 10.11 安装文件:.dmg文件 MySQL:mysql-5.7.12-osx10.11-x86_64.dmg(注意5.7跟之前的字段有些不同, ...

随机推荐

  1. 【BZOJ4385】[POI2015]Wilcze doły 单调栈+双指针法

    [BZOJ4385][POI2015]Wilcze doły Description 给定一个长度为n的序列,你有一次机会选中一段连续的长度不超过d的区间,将里面所有数字全部修改为0.请找到最长的一段 ...

  2. ES6入门概览二--数组

    一 数组 1. Array.from() 将两类对象转为真的数组 : 类似数组的对象(伪数组,如arguments.document.getElementsByTagNames等)和可遍历对象(包括E ...

  3. angualar入门学习-- 自定义指令 认识属性

    个AngularJS指令在HTML代码中可以有四种表现形式: 1.作为一个新的HTML元素来使用 2.作为一个元素的属性来使用 3.作为一个元素的类来使用 4.作为注释来使用 一.创建指令 angul ...

  4. c# Log4net的结构

    log4net 有四种主要的组件,分别是Logger(记录器), Repository(库), Appender(附着器)以及 Layout(布局).

  5. 第4章 x86反汇编速成班

    4.1 抽象层次 硬件<微指令<机器码<低级语言<高级语言<解释型语言 4.2 逆向工程 4.3 x86体系结构 冯-诺依曼体系结构 中央处理器(CPU): 负责执行代码 ...

  6. dev EditMask 设置方法

    官方帮助地址: https://documentation.devexpress.com/WindowsForms/583/Controls-and-Libraries/Editors-and-Sim ...

  7. jmeter断言之BeanShell断言

    1.添加BeanShell断言,在Script下面写断言脚本,常用的BeanShell脚本如下: if(!SampleResult.getResponseCode().equals("200 ...

  8. sql语句select group by order by where一般先后顺序

    写的顺序:select ... from... where.... group by... having... order by..执行顺序:from... where...group by... h ...

  9. java中byte[] 和16进制字符串互转

    //将byte[]转换为16进制字符串 public static String byte2hex(byte[] b) { StringBuilder hs = new StringBuilder() ...

  10. Linux(6)- redis发布订阅/持久化/主从复制/redis-sentinel/redis-cluster、nginx入门

    一.redis发布订阅 Redis 通过 PUBLISH .SUBSCRIBE 等命令实现了订阅与发布模式. 其实从Pub/Sub的机制来看,它更像是一个广播系统,多个Subscriber可以订阅多个 ...