当前位置:网站首页>使用navicat连接mysql数据库时常报的错误:2003、1698、1251
使用navicat连接mysql数据库时常报的错误:2003、1698、1251
2022-07-30 05:50:00 【m0_67402970】
连接不上数据库
error 1698
报错提示:ERROR 1698 (28000): Access denied for user 'root'@'localhost'
报错原因: 在安装mysql数据库的过程中未给root用户设置密码,导致不能登陆成功
解决措施: 设置数据库root用户密码
第一步:update mysql.user set authentication_string=PASSWORD('root'),plugin='mysql_native_password' where user='root';
第二步:flush privileges;
(刷新)
第三步:用root用户的新密码登录mysql
error 2003
报错提示:
第一种: 2003 - Can't connect to MySQL server on 'localhost'(10061 "Unknown error")
(本地连接数据库出错)
或者第二种:2003-cant connection to mysql server on ‘IP’(10061 unknown error)
(服务器远程连接出错:未知错误)
或者第三种:Can't connect to MySQL server on "IP地址'(10038)
(服务器远程连接数据库出错:防火墙出错)
报错原因:
第一个错误提示的原因:mysql服务未成功启动,所以连接不上
第二个错误提示的原因:注意这个10061 unknown error,表示未知错误,出错的原因可能是:(1)mysql服务未成功启动(2)配置文件出错
第三个错误提示的原因:报10038表示服务器防火墙没有开启3306端口
解决措施:
(1)针对第一个错误提示的解决:与mysql服务是否启动有关,去重新启动下服务:
方式一:右击计算机=>管理=>服务和应用程序=>服务=>找到MySQL服务,启动,甚至可以改为自启动,这样之后电脑开机后mysql服务就会自动启动了
方式二:或者在mysql安装目录的bin目录下输入命令net start mysql
启动mysql服务
(2)针对第二个错误提示的解决:(全程在服务器端操作)
第一步:先查看mysql服务是否开启,如果开启了,表示不是服务未启动的问题,则看第二步
第二步:登入mysql数据库:musql -u 用户 -p 密码
第三步:输入use mysql;
再输入:update user set Host='%' where User='root';
(这表示修改mysql库的user表,将host项,从localhost改为%。%这里表示的是允许任意host访问,如果只允许某一个ip访问,则可改为相应的ip。)
第四步:exit
命令退出数据库,服务器终端输入命令vim /etc/mysql/mysql.conf.d/mysqld.cnf
来打开配置文件mysqld.cnf
,修改43行的bind_address=127.0.0.1为bind_address=0.0.0.0
第五步:重启mysql服务,service mysql restart
(3)针对第三个错误提示的解决:
第一步:打开防火墙配置文件:vim /etc/sysconfig/iptables
第二步:将配置文件中的一行A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
中的80改为3306
第三步:重启防火墙:service iptables restart
error 1251
报错提示:1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client.
报错原因:发现是从MySQL8.0 高级版本的时候出现的问题,而8之前的低版本都还没有这个问题。MySQL8.0版本改变了密码的验证规则导致的问题。
解决措施:
第一步:更新密码alter user 'root'@'localhost' identified with mysql_native_password by '设置新密码';
注意:如果还是出错,就将localhost改为%,这样就可以解决了,解释:登录mysql数据库,使用use mysql; 命令后,再输入 select user,host form user; 查看root用户和它对应的host,有的数据库中的root对应的host是localhost,有的对应的host是%
第二步:刷新FLUSH PRIVILEGES
边栏推荐
- debian problem
- Ali two sides: List several tips for Api interface optimization
- uniapp中canvas与v-if更“配”
- proftpd 配置文件说明
- Headline 2: there are several kinds of common SQL errors in MySQL usage?
- What new materials are used in the large aircraft C919?
- Let the "label" content in Baidu map generator expand--solution
- 这个终端连接工具,碾压Xshell
- Camera coordinate system, world coordinate system, pixel coordinate system conversion, and Fov conversion of OPENGLDEFocal Length and Opengl
- Pioneer in Distributed Systems - Leslie Lambert
猜你喜欢
引导过程与服务控制
What new materials are used in the large aircraft C919?
Data types of Redis6
Electron之初出茅庐——搭建环境并运行第一个程序
Test development engineer growth diary 016 - those things about the test
DHCP原理与配置
Pioneer in Distributed Systems - Leslie Lambert
Polygon 3D(三维平面多边形)的法向量的计算(MeshLab默认的计算)
The first artificial intelligence safety competition officially launched
Bull: remove common characters
随机推荐
计算矩阵的逆源码(使用伴随矩阵,3×3的矩阵)
Rodrigues:旋转矩阵的向量表达
LVM and disk quotas
万能js时间日期格式转换
阿里二面:列出 Api 接口优化的几个技巧
DNS domain name resolution services
New material under the plastic restriction order - polylactic acid (PLA)
Test Development Engineer Growth Diary 017 - The Life Cycle of a Bug
RAID磁盘阵列
空间顶点到平面的距离计算的证明及其源码
Table with tens of millions of data, how to query the fastest?
When does MySQL use table locks and when does it use row locks?
Proof of distance calculation from space vertex to plane and its source code
idea内置翻译插件
Let the "label" content in Baidu map generator expand--solution
Ali: How many methods are there for multi-threaded sequential operation?
MongoDB - Introduction, Data Types, Basic Statements
DHCP principle and configuration
MySQL什么时候用表锁,什么时候用行锁?
Upload file -- file type, picture type, document type, video type, compressed package type