博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CentOS 6.5下 mysql用户root登录不了
阅读量:4137 次
发布时间:2019-05-25

本文共 641 字,大约阅读时间需要 2 分钟。

今天在虚拟机上登录mysql 时提示Access denied for user 'root'@'localhost' (using password: YES),

下面分享下处理方法:

1. 关闭mysql 服务

[root@localhost ~]# service mysql stop

2. 不使用密码直接登录

[root@localhost ~]# sudo mysqld_safe --skip-grant-tables &

3. 然后执行mysql 直接登录

[root@localhost ~]# mysqlWelcome to the MySQL monitor.  Commands end with ; or \g....Your MySQL connection id is 1Server version: 5.6.30-1 (Debian)Copyright (c) 2000, 2016, Oracle and/or its affiliates.Mysql>

4. 进入数据库后,切换到mysql 数据库

mysql> use mysql;

5. 切换数据库后, 执行修改密码指令

mysql> update user set password = password('新的密码') where user = 'root';

6. 启动mysql 服务,再使用新密码登录

[root@localhost ~]# service mysql start

 

转载地址:http://ztqvi.baihongyu.com/

你可能感兴趣的文章
readn和writen函数一览------顺便说说recv函数的MSG_WAITALL参数
查看>>
聊聊tcp四次挥手中的TIME_WAIT状态存在的理由
查看>>
shutdown能做哪些close做不了的事?
查看>>
工作四年的一些经历和感悟------在扯淡的世界中尽力而为
查看>>
僵尸进程示例分析------顺便说说linux中的wait和waitpid
查看>>
linux fork多进程并发服务器模型之C/C++代码实战
查看>>
linux accept函数与三次握手没有半毛钱的关系------三次握手可能发生在调用accept函数之前
查看>>
用php代码获取机器的ip地址
查看>>
g++: cannot specify -o with -c or -S with multiple files 和nm: test.o: File format not reco 的原因和解决方案
查看>>
nm: test.o: File format not recognized的原因和解决方案
查看>>
libtest.a: could not read symbols: Archive has no index; run ranlib to add one的原因和解决方案
查看>>
线程其实很简单
查看>>
别把&和nohup混为一谈, 根本不是同一个东西好不好 ------ 聊聊./a.out & , nohut ./a.out , nohup ./a.out &的区别
查看>>
守护进程(daemon)很简单------第一次玩setsid函数
查看>>
用linux下的daemon函数来玩守护进程------类似于nohup ./a.out &
查看>>
php和apache其实没有什么关系
查看>>
PHP的四种运行模式
查看>>
PHP——底层运行机制与原理
查看>>
so库又一次遇到 undefined symbol------ldd, nm, c++filt命令大显身手
查看>>
历经漫长的跟踪、排查、对比、推动和验证, 终于在8个月后,解决了这个bug
查看>>