今天linux下mysql:access denied for user'root'@'localhost' using password yes,以及使用navicat登陆mysql
来源:互联网 发布:如何在linux下编程 编辑:程序博客网 时间:2024/05/30 02:52
今天linux下安装和使用mysql遇到问题accessdenied for user'root'@'localhost' using password yes,以及使用navicat登陆mysql遇到Can'tconnect to Mysql on '主机名'(10061)解决方法
linux下安装了mysql,采用的是apt命令一键安装:
apt install mysql-server
安装完之后设置了密码,然后用密码可以登录
但为了其他主机连接该机器,进行了如下操作:
mysql –u root p
输入密码:
use mysql;
//XXX为设置项,变量
insert user (host,user,password),values(‘XXX’,’XXX’,password(XXX));
flush privileges;
quit;
然后就发现再登陆时发现出现了错误:
access denied for user'root'@'localhost' using password yes
相当郁闷,密码试了N次都不行。
看网上的说法都是改user表。
试了一下,没效果,突然想了想之前只是添加了一个用户,
先用安全模式登陆:
mysqld_safe --user=mysql --skip-grant-tables --skip-networking&
登陆成功之后,切换到mysql:
use mysql;
查看用户表:
select host,user from user;
发现有好几个用户,而且localhost域名用户的user不是root:也就是说没有一个和root对应的host为localhost的用户。只有一个127.0.0.1和root对应(127.0.0.1就是loc alhost但不知为啥登陆不上)。
于是将除了user:root,host:127.0.0.1以外的删除。
delete from user where host not in (‘127.0.0.1’);
然后将host改为localhost:
update user set host = ‘localhost’, password = password(XXX) where user= ‘root’;
flush privileges;
quit;
然后就可以登录了。
下面提供一个远程navicat登陆mysql的方法:
登陆mysql
修改之前root的host为’%’
quit;
退出。
然后切换到管理员权限:
sudo –i
输入密码:
vi /etc/mysql/my.cnf
将bind-address改为0.0.0.0
保存退出。
重启mysql
service mysql restart
即可远程登陆mysql;
- 今天linux下mysql:access denied for user'root'@'localhost' using password yes,以及使用navicat登陆mysql
- linux下使用mysql数据库出现 “Access denied for user 'root'@'localhost' (using password: YES)”
- 总结linux下使用mysql数据库出现 “Access denied for user 'root'@'localhost' (using password: YES)”
- linux下使用mysql数据库出现 “Access denied for user 'root'@'localhost' (using password: YES)”
- linux下连接windows mysql的错误:Access denied for user 'root'@'localhost' (using password: YES)
- Linux下连接Mysql出现:Access denied for user 'root'@'localhost' (using password:YES)的解决方法
- linux 下mysql 报 ERROR 1045 (28000): Access denied for user '-root'@'localhost' (using password: YES)
- linux下安装mysql后Access denied for user 'root'@'localhost' (using password: YES)
- linux下mysql Access denied for user 'root'@'localhost' (using password:YES)
- mysql Access denied for user 'root'@'localhost' (using password: YES)
- mysql Access denied for user 'root'@'localhost' (using password: YES)
- MySql Access denied for user 'root'@'localhost' (using password: YES)
- mysql access denied for user'root'@'localhost' using password yes
- mysql Access denied for user 'root'@'localhost' (using password: YES)
- mysql:Access denied for user 'root'@'localhost' (using password:YES)
- MySQL:Access denied for user 'root'@'localhost' (using password:YES)
- navicat(MySql)错误1045 Access denied for user 'root'@'localhost' (using password:YES)
- 关于Navicat mysql连接出现1045 access denied for user 'root'@'localhost' using password: yes
- eclipse 导出war包时报svn更新状态失败问题
- Linux 应用开发
- Flume基本使用
- 关于NavigateUrl中绑定Eval()方法时出现"服务器标记的格式不正确"的解决方法
- Circular placeholder reference 'jdbc.driver' in property definitions
- 今天linux下mysql:access denied for user'root'@'localhost' using password yes,以及使用navicat登陆mysql
- css实现弹出框在页面居中
- Python 的枚举 Enum
- C++的STL库一些方法调用
- Python下的tail库 tail.py修正版
- Java多线程编程实战指南(核心篇)读书笔记(一)
- 计算机字符编码详解一
- 通过百度地图API绘制经纬度map
- 集合框架——Map的两种取出方式(keySet和entrySet)