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数据库了。

原文地址:http://blog.51cto.com/meiling/2155927

时间: 2024-07-30 05:37:24

Mysql报错message from server: ERROR 1062 (23000):的相关文章

Ajax 报错 500 (Internal Server Error)

==========error======={"readyState":4,"responseText":"<html><head><title>Apache Tomcat/6.0.35 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#

CI当开启URL重写的时候,报错500 Internal Server Error

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions y

mysql报错!The server quit without updating PID file问题的解决办法

几种可能情况和解决方案 1.可能是/usr/local/mysql/data/mysql.pid文件没有写的权限解决方法 :给予权限,执行 "chown -R mysql:mysql /var/data" "chmod -R 755 /usr/local/mysql/data"  然后重新启动mysqld! 2.可能进程里已经存在mysql进程解决方法:用命令"ps -ef|grep mysqld"查看是否有mysqld进程,如果有使用"

安装mysql报错—解决方法:error while loading shared libraries: libssl.so.6

for 32bit ln -sf /usr/lib/libssl.so.10 /usr/lib/libssl.so.6ln -sf /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so.6 for 64bit ln -sf /usr/lib64/libssl.so.10 /usr/lib64/libssl.so.6ln -sf /usr/lib64/libcrypto.so.10 /usr/lib64/libcrypto.so.6

在CentOS中安装32位或64位MySql报错error: Failed dependencies解决办法

在CentOS中安装MySql报错error: Failed dependencies解决办法 安装64位MySql报错内容如下:error: Failed dependencies:        libaio.so.1()(64bit) is needed by MySQL-server-5.6.19-1.el6.x86_64    libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.6.19-1.el6.x86_64    

连接mysql报错:error 2003 (hy000):can&#39;t connect to mysql server on &#39;localhost&#39; (10061)

一.mysql 的bin目录下有个MySQLInstanceConfig.exe,运行就可以进行创建数据库实例,创建实例时也可以生成windows 服务,把服务设置成自动启动就可以了 二.安装在D盘的discuzz!打开后出现上述错误,请问应如何处理?winmysqladmin已经启动,但三色树上有一个小红点如果出现"ERROR 2003: Can't connect to MySQL server on 'localhost' (10061)",说明你的MySQL还没有启动.解决办法

mysql报错ERROR 2003 (HY000): Can&#39;t connect to MySQL server on &#39;localhost&#39; (10061)

23:29:02/2017-05-03 现象描述:在Command Line Client可以登陆,但是在命令提示符cmd下登陆出错. 我最终的解决办法是: 我先去看了一下我的my.ini配置文件. 新版5.7的配置文件不是在安装目录,而是在programDat/mysql文件目录下 打开文件之后: 我在安装的时候修改了默认端口3306为8082, 在cmd登陆的时候仍然是默认端口登陆的,所以会报错.那么在登陆的 时候可以指定端口, -P一定要大写. mysql报错ERROR 2003 (HY0

长久不用的mysql报错ERROR 2002 (HY000): Can&#39;t connect to local MySQL server through socket &#39;/tmp/mysql.sock&#39; (2)

mac上安装过mysql: 然而,尝试连接时报错: $ mysql -u root -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 尝试去查看mysql.socket文件,发现没有.. $ which mysql /usr/local/bin/mysql 然后试试重启mysql: $ mysql.server start

mac 安装mysql 报错“ERROR 2002 (HY000): Can not connect to local MySQL server through socket &#39;/tmp/mysql.sock&#39; (2)” 解决办法

首先安装 homebrew 再 brew install mysql 之后连接 mysql 无论是登录还是修改初始密码都会报如下的错误 ERROR 2002 (HY000): Can not connect to local MySQL server through socket '/tmp/mysql.sock' (2) 运行如下解决:参考 http://www.thinksaas.cn/group/topic/347978/ unset TMPDIR mysql_install_db --v