网站报错Access denied for user 'root'@'localhost' -问题排查续
网站报错Access denied for user 'root'@'localhost' (using password: YES)
每次的挽救办法就是:
/etc/init.d/mysqld stop
mysqld_safe --skip-grant-tables &
几乎每隔10分钟就出现一次,如下图,然后手动安全模式重启mysql。偶的内心好崩溃。。。
不得不赞阿里云的售后技术支持太给力!耐心回复我的一个个小白问题。
总结一下,
问题原因:本地授权问题
解决办法:“您目前启动到mysql安全模式下,您登陆mysql,重新授权一下,允许root账号从本地登陆mysql。授权完成后您再按照之前给您说的步骤,正常启动mysql即可”
解决过程,具体展开解释如下:
1. 安全模式启动mysql
/etc/init.d/mysqld stop
mysqld_safe --skip-grant-tables &
2. 进入mysql命令行,#mysql (安全模式不需要密码即可登录mysql,开始偶还吓尿了。。。囧。。。)
3. 更改root用户的密码
mysql>UPDATE mysql.user SET Password = password ( 'fxs_415700' ) WHERE User = 'root' ;
对sql语句的执行一定要加分号(囧。。。多年不写SQL代码)
不妨用查询语句暖场 select User,Host from mysql.user WHERE User = 'root'; 查出了三条记录
4. 更改root用户的“host”值,已确保本地被授权
mysql>update mysql.user set host='localhost' where user='root';
(此步实际执行有错,因为host是键值,故上述select语句有必要,尤其是当没使用第三方mysql工具譬如sequel pro的话)
5. mysql>flush privileges ;
6. 退出mysql
mysql>quit
7. 停止mysql, 并查看是否还有mysql进程,有的话kill掉
# /etc/init.d/mysqld stop
通过 ps aux | grep mysql 查看mysql进程id
# ps aux | grep mysql
root 4043 0.0 0.0 63852 1252 pts/0 S 17:20 0:00 /bin/sh /usr/bin/mysqld_safe --skip-grant-tables
mysql 4234 23.7 1.0 228300 21992 pts/0 Sl 17:20 7:24 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin- dir=/usr/lib64/mysql/plugin --user=mysql --skip-grant-tables --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
查得进程ID,kill掉
# kill -9 4043
# kill -9 4234
8. 启动mysql
#/etc/init.d/mysqld start
(当时因为sql语句没加;即本地授权操作3、4、5三步未执行成功,第8步执行完后,mysql启动,网站access deny错误依旧)
网站报错Access denied for user 'root'@'localhost' -问题排查续的更多相关文章
- 008-MySQL报错-Access denied for user 'root'@'localhost' (using password: NO)
1.新安装的mysql报错 MySQL报错-Access denied for user 'root'@'localhost' (using password: NO) 解决方案 1.先停掉原来的服务 ...
- MySQL登录报错"Access denied for user 'root'@'localhost' (using password: YES)"
最近登录MySQL时候总报错: # mysql -uroot -p Enter password: ERROR (): Access denied for user 'root'@'localhost ...
- 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 ...
- 连接数据库报错Access denied for user 'root'@'localhost' (using password:YES)
报错信息为:pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using pa ...
- mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”)的处理方法
环境 CentosOS 6.5 ,已安装mysql 情景 root密码忘记,使用普通用户无法登录 解决 问题一 无法使用mysql命令 参考文章:https://www.cnblogs.com/com ...
- 运行JavaWeb项目报错Access denied for user 'root'@'localhost' (using password: YES)
问题重现:(以下讨论范围仅限Windows环境): C:\AppServ\MySQL> mysql -u root -p Enter password: ERROR 1045 (28000): ...
- MySQL5.7.20报错Access denied for user 'root'@'localhost' (using password: NO)
在centos6.8上源码安装了MySQL5.7.20,进入mysql的时候报错如下: 解决办法如下: 在mysql的配置文件内加入: vim /etc/my.cnf skip-grant-tabl ...
- 最新 mysql登录报错“Access denied for user 'root'@'localhost' (using password: NO”的处理方法
1.关闭正在运行的MySQL.2.打开DOS窗口,转到mysql\bin目录.3.输入mysqld --skip-grant-tables回车.如果没有出现提示信息,那就对了.(正常的情况是光标闪烁没 ...
- mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”的处理方法
使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码: 文件内容: [client]host = localhostuser = debian-sys-maint ...
随机推荐
- jQuery 判断div是否shown
// Checks for display:[none|block], ignores visible:[true|false] $(element).is(":visible") ...
- .NET学习笔记(2) — IIS服务器环境搭建
目录 一:开启Windows系统自带的IIS服务器方法 二:备注 三:常见问题 一:开启Windows系统自带的IIS服务器方法 第一步:安装IIS,控制面板->程序和功能-> ...
- 轻松学习Ionic (一) 搭建开发环境,并创建工程
1.准备工作 下载 Node.js(下载包),WebStorm(IDE,编写代码,浏览器调试),JDK(webstorm 运行环境),Android SDK (Android编译) 不 ...
- h2database源码浅析:锁与MVCC
Table Level Locking The database allows multiple concurrent connections to the same database. To mak ...
- union判断CPU是little-endian还是big-endian存储
利用联合体的特殊存储方式,便能检测出来cpu所使用的事big-endian或者是little-endian的存储方式. 1.判断系统是Big liden 或者是little ledin 方法1:in ...
- WebService开发常用功能详解
一.WebService中常用的属性(Attributes)1. Web Service(Web服务)提供以下三个属性. Namespace:此属性的值包含 XML Web Service的默认 ...
- iOS block的使用
明明知道block是一个很重要的知识点,很久不用就又忘了,这是在网上看到的一个例子.(晚上回去整理另外的一个) 在视图A上有一个按钮(用来在点击的时候推出视图b)和一个label(用来显示从b传回来的 ...
- 中文字符集编码Unicode ,gb2312 , cp936 ,GBK,GB18030
中文字符集编码Unicode ,gb2312 , cp936 ,GBK,GB18030 内容详见: http://www.360doc.com/content/11/1004/12/6139921_1 ...
- FreeMarker在JAVA中应用入门
在项目中通常有生成XML文件发送到另一个系统的需求,简单的办法可以是用一个XML模板,通过Freemarker替换其中的'Mark'(${}),生成最终的XML文件. 下面记录了一下简单的示例步骤: ...
- 九度OJ 1528 最长回文子串 -- Manacher算法
题目地址:http://ac.jobdu.com/problem.php?pid=1528 题目描述: 回文串就是一个正读和反读都一样的字符串,比如"level"或者"n ...