解决linux-mysql 登录时,报异常:Access denied for user 'root'@'localhost'
解决linux-mysql 登录时,报异常:Access denied for user 'root'@'localhost'
第一步:停服务
/etc/init.d/mysql stop
或者
service mysqld stop
第二步:跳过密码验证
执行命令行:
# /usr/bin/mysqld_safe --skip-grant-tables
报:
151104 09:07:56 mysqld_safe Logging to '/var/lib/mysql/iZ23dq2wm0jZ.err'.
151104 09:07:56 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
第三步:无密码登录
执行命令行:
mysql -u root
第四步:授权
mysql>
grant all privileges on *.* to 'root'@'localhost' identified by 'root' with grant option;
关键词解释:
root'@'localhost:是用户
root:是密码
问题一:发现无密码条件下,没有授权的写权限
The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
解决方法:
mysql> set global read_only=0;//(关掉新主库的只读属性)
mysql>flush privileges;
再次执行第四步授权语句:grant all privileges on *.* to 'root'@'localhost' identified by 'root' with grant option;
mysql>set global read_only=1;//(读写属性)
mysql>flush privileges;
(注意刷新是必须项)
第五步:重启数据库
/etc/init.d/mysql restart
或者
service mysql restart
解决linux-mysql 登录时,报异常:Access denied for user 'root'@'localhost'的更多相关文章
- 解决MySQL登录ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor)问题
问题描述 今天在MAC上安装完MySQL后,MYSQL默认给分配了一个默认密码,但当自己在终端上使用默认密码登录的时候,总会提示一个授权失败的错误:Access denied for user ‘ro ...
- 解决Linux下MySQL登录ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor)问题
两种方案: 一: 1.修改mysql配置文件:vim /etc/my.cnf 2.找到[mysqld]下添加 skip-grant-tables 配置 3.重启服务service mysqld res ...
- (转载)解决MySql 数据库 提示:1045 access denied for user 'root'@'localhost' using password yes
今天想用用MySQL 数据库 谁知道老提示 1045 access denied for user 'root'@'localhost' using password yes 最后在csdn 上找到 ...
- Mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) Linux: MyS ...
- 网站报错Access denied for user 'root'@'localhost' -问题排查续
网站报错Access denied for user 'root'@'localhost' (using password: YES) 每次的挽救办法就是: /etc/init.d/mysqld st ...
- 008-MySQL报错-Access denied for user 'root'@'localhost' (using password: NO)
1.新安装的mysql报错 MySQL报错-Access denied for user 'root'@'localhost' (using password: NO) 解决方案 1.先停掉原来的服务 ...
- 转: windows系统下mysql出现Error 1045(28000) Access Denied for user 'root'@'localhost'
windows系统下mysql出现Error 1045(28000) Access Denied for user 'root'@'localhost' 转自 http://zxy5241.space ...
- 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 ...
- mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”)的处理方法
环境 CentosOS 6.5 ,已安装mysql 情景 root密码忘记,使用普通用户无法登录 解决 问题一 无法使用mysql命令 参考文章:https://www.cnblogs.com/com ...
- MySQL登录报错"Access denied for user 'root'@'localhost' (using password: YES)"
最近登录MySQL时候总报错: # mysql -uroot -p Enter password: ERROR (): Access denied for user 'root'@'localhost ...
随机推荐
- 用python开发了一个简单apache web服务端范例,在win10 + apache2.4.9 + python3.5 测试成功
#!D:\Programs\Python\Python35-32\python.exe import cgi def htmlTop(): print("Content-type: ...
- 2 小时学会 Spring Boot
一. 什么是 Spring Boot Takes an opinionated view of building production-ready Spring applications. Sprin ...
- python-FTP模块
#!/user/bin/python #coding=utf-8 import ftplib import os import socket HOST = 'ftp.kernel.org' DIRN ...
- orcale 之pl/sql例外
orcale 中的例外我们可以看作是其他编程语言中的异常,是为了增强语言的健壮性和容错性. 在orcale中常见的有以下几种: No_data_found 很容易理解就是没有数据返回. Too_man ...
- [中英对照]Device Drivers in User Space: A Case for Network Device Driver | 用户态设备驱动: 以网卡驱动为例
前文初步介绍了Linux用户态设备驱动,本文将介绍一个典型的案例.Again, 如对Linux用户态设备驱动程序开发感兴趣,请阅读本文,否则请飘过. Device Drivers in User Sp ...
- java String 提供的方法
String类的判断功能: * boolean equals(Object obj):比较字符串的内容是否相同,区分大小写 * boolean equalsIgnoreCase(String str) ...
- Prinzipien der Computer Zusammensetzung
1.Die Einfuerung der Computer System 1.1 Computer Zusammensetzung und Computer Architektur Unter Com ...
- echo(),print(),print_r()之间的区别?
echo是PHP语句, print和print_r是函数,语句没有返回值,函数可以有返回值(即便没有用) print只能打印出简单类型变量的值(如int,string) print_r可以打印出复 ...
- Ruby(2): 基本语法上
表达式和变量: 这两点和其他主流的编程语言基本没有差别,这里直接跳过. 需要注意的是 ruby中 x=x+1 可以写成 x+=1 但是不支持 x++ , x-- 等一元运算符 比较运算符和表达式: ...
- 举一反三 willDisplayCell在UICollectionView中的一些应用
一.UICollectionViewCell动画 上一篇博客写仿58同城实现UITableViewCell动画,同样UiCollectionView中也能用,上一个是从右到左的动画还比较好弄, 但如果 ...