Mysql报错message from server: ERROR 1062 (23000):
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mysql报错message from server: ERROR 1062 (23000):相关的知识,希望对你有一定的参考价值。
Mysql连接报错:java.sql.SQLException:null,message from server:"Host '27,45,38,132' is not allowed to connect.
原因是:远程服务器不允许你的java程序访问它的数据库。所以,我们要对远程服务器进行设置,使它允许你进行连接。
工具sqldeveloper连接远程的MySQL 数据库时,配置连接信息,连接发生错误,提示:message from server: "Host '192.168.1.8' is not allowed to connect to this MySQL server
但是将IP地址改为localhost又能正常连接到MySQL数据库。
临时处理方案:
1、先用localhost方式连接到mysql数据库,然后使用MySQL自带的数据库mysql;
# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 971 Server version: 5.5.56-log Source distribution Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> mysql> use mysql; Database changed mysql> show tables; +---------------------------+ | Tables_in_mysql | +---------------------------+ | columns_priv | | db | | event | | func | | general_log | | help_category | | help_keyword | | help_relation | | help_topic | | host | | ndb_binlog_index | | plugin | | proc | | procs_priv | | proxies_priv | | servers | | slow_log | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ 24 rows in set (0.00 sec)
2、执行:select host from user where user = 'root'; 发现,host的值就是localhost。
所以将它的值改掉:update user set host='%' where user = 'root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY' 不予理会
3、修改完成后,执行:flush privileges;
将修改内容生效,再次配置时,用IP地址或者localhost 就都能正常连接到MySQL数据库了。
以上是关于Mysql报错message from server: ERROR 1062 (23000):的主要内容,如果未能解决你的问题,请参考以下文章
Mysql更新数据时,报 “You can't specify target table 'message ' for update in FROM clause” 解决办法
今天碰到报错 Data source rejected establishment of connection, message from server: "Too many conne
远程连接mysql root账号报错:2003-can't connect to MYSQL serve
记录一次爬虫报错:Message: Failed to decode response from marionette
远程登陆mysql报错:ERROR 1130 (HY000): Host '10.0.0.8' is not allowed to connect to this MySQL serv
IDEA配置IDEA连接mysql报错Server returns invalid timezone. Go to 'Advanced' tab and set 'serv