完美解决Mysql的Access denied for user 'root'@'%的'问题
背景:mysql5.6 root已授权所有数据库,执行过下面的语句
grant all privileges on *.* to 'root'@'%' identified by 'root'
当使用root登录,然后新建数据库,新建用户的时候,给新用户授权的时候却提示 access deny
解决办法:
第一步:停服务
命令行:
/etc/init.d/mysql stop
如果不行,就执行下一行:
service mysqld stop
报:
Stopping mysqld: [ OK ]
第二步:跳过密码验证
执行命令行:
# /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:是密码
with grant option 这句话就是给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;
mysql>exit;
(注意刷新是必须项)
第五步:重启数据库
service mysqld stop
报:
Stopping mysqld: [ OK ]
service mysqld start
报:
Starting mysqld: [ OK ]
或者
service mysqld restart
原文链接:http://blog.csdn.net/nicajonh/article/details/52311402
完美解决Mysql的Access denied for user 'root'@'%的'问题的更多相关文章
- mysql登录:access denied for user 'root'@'localhost'(using password:YES)
mysql登录: access denied for user 'root'@'localhost'(using password:YES) 解决: use mysql; select user,ho ...
- mysql中Access denied for user 'root'@'localhost' (using password:YES)
关于昨天下午说的MySQL服务无法启动的问题,解决之后没有进入数据库,就直接关闭了电脑. 今早打开电脑,开始-运行 输入“mysql -uroot -pmyadmin”后出现以下错误: “Access ...
- mysql中Access denied for user 'root'@'localhost' (using password:YES)(zhuan)
错误代码 1045Access denied for user 'root'@'localhost' (using password:YES) 如果你的mysql也出现以上这种提示, 建议你逐个字看完 ...
- MySQL 出现 Access denied for user 'root'@'localhost' (using password: YES) 错误
登录某台服务器的mysql时候总报错: mysql2/client.rb:58:in `connect': Access denied for user 'root'@'localhost' (usi ...
- linux连接mysql 出现Access denied for user 'root'@'localhost'(using password: YES)错误解决方案
linux连接mysql /usr/local/mysql/bin/mysql -uroot -p 输入密码出现Access denied for user 'root'@'localhost'(us ...
- MySQL出现Access denied for user ‘root’@’localhost’ (using password:YES)
连接时MySQL出现了下面的错误: Access denied for user ‘root’@’localhost’ (using password:YES) 解决的办法是先停止MySQL服务,在m ...
- 登录mysql 报 Access denied for user 'root'@'localhost' 错误
安装mysql后登录提示:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:yes) 解决如下 ...
- mysql错误 Access denied for user 'root'@'xxx.xxx.xxx.xxx' (using password: YES)
mysql -u root -p Aaa111222333 grant all privileges on *.* to root@'%' identified by 'aaa111222333; Q ...
- MySQL出现Access denied for user 'root'@'%' to database 'netai_test'问题
访问数据库时报错信息 Access denied for user 'root'@'%' to database 'netai_test' 原因:这是由于创建数据库后没有对用户授权,使用户可以访问数据 ...
随机推荐
- ABAP 判断字符串是否是数字
通过正则表达式: IF cl_abap_matcher=>matches( pattern = '^(-?[1-9]\d*(\.\d*[1-9])?)|(-?0\.\d*[1-9])$' tex ...
- Redis 几个类型常用命令
Redis 字符串(String) 下表列出了常用的 redis 字符串命令: 序号 命令及描述1 SET key value 设置指定 key 的值2 GET key 获取指定 key 的值.3 G ...
- Invalid Django TIME_ZONE
在linux操作系统运行,设置的时区在系统文件/usr/share/zoneinfo/中找不到会出现以下错误 raceback (most recent call last): File , in & ...
- 使用docker-client创建NFS挂载
docker命令行挂载NFS如下: docker volume create --driver local --opt type=nfs --opt o=addr=192.168.11.129,rw ...
- Android开发 移动端适配
1 UI自适应(UGUI) UI自适应又分为锚点自适应和缩放.锚点主要控制UI控件在父控件之中的位置,同时也能影响缩放. 锚点自适应缩放: 我们使用UGUI创建一个界面,设计使用1920x1080分辨 ...
- VMware重装:网络适配器驱动安装失败解决办法
参考链接:https://blog.csdn.net/theConqueror/article/details/80449125
- PTA(Basic Level)1014.福尔摩斯的约会 && PTA(Advanced Level)1061.Dating
大侦探福尔摩斯接到一张奇怪的字条:我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm.大侦探很快就明白了,字条上奇 ...
- 如何使用JavaScript实现前端导入和导出excel文件
一.SpreadJS 简介 SpreadJS 是一款基于 HTML5 的纯 JavaScript 电子表格和网格功能控件,以“高速低耗.纯前端.零依赖”为产品特色,可嵌入任何操作系统,同时满足 .NE ...
- 小记---------破解idea2018.3.6 转载
一.进入idea官网选择想要下载的版本 官网版本选择页面: https://www.jetbrains.com/idea/download/other.html IntelliJ IDEA 分为两 ...
- (电脑重置之后)win10在桌面点右键鼠标一直转圈;无法点击桌面图标;
昨天重置系统之后,发现了这个毛病.桌面任务栏都能正常点击,就是一到桌面,无法点击桌面上面的图标(刚开机的时候还可以点).想新建文件夹来着,一点右键,鼠标即开始转圈圈.本来以为自己能好,结果第二天了还这 ...