Newly deployed Linux Web server error Host ' *.*.*.* ' is not allowed to connect to this MySQL server

Source: Internet
Author: User
Tags sql error

Recently, I've been given a task to deploy a Web site developed under the Windows platform to a Linux environment.

Install MySQL, all forms are imported no problem, then the code is placed under Tomcat under the WebApps folder, home

Faces can be displayed normally, but there are two problems:

    1. When users log in or register, always prompt: Connecting to 192.168.2.109 ... (IP of Linux server);
    2. View Tomcat log file There's a bunch of catalina.out.

[WARN] [2014-07-09 21:28:58,706] [Org.hibernate.engine.jdbc.spi.SqlExceptionHelper] SQL error:1146, SQLSTATE:42S02

[ERROR] [2014-07-09 21:28:58,707] [Org.hibernate.engine.jdbc.spi.SqlExceptionHelper] Table ' BJXT. T_deadline ' doesn ' t exist

[WARN] [2014-07-09 21:28:59,302] [Org.hibernate.engine.jdbc.spi.SqlExceptionHelper] SQL error:1146, SQLSTATE:42S02

[ERROR] [2014-07-09 21:28:59,302] [Org.hibernate.engine.jdbc.spi.SqlExceptionHelper] Table ' BJXT. T_deadline ' doesn ' t exist

......

This article mainly discusses these two questions.

First question:

Connecting to 192.168.2.109 ... Indicates a problem with the backend of the connection, which may be a problem with Tomcat or

The MySQL problem caused the connection to remain in the state. I did the following things:

1 Shut down the firewall first, then test again, find the situation is still, prove not port problem

#/etc/init.d/iptable Stop//firewall off

#/etc/init.d/iptable Restart//restart firewall

2 Modify the site's profile localhost for 192.168.2.109 or 127.0.0.1 test separately, no results. Prove not before

End IP problem, the judgment should be the back end problem.

3 Check Tomcat connection status, restart Tomcat;

4 Check the port listening status, 3306 monitoring is normal;

5 Start troubleshooting MySQL: Remove the default and redundant users in MySQL, avoid distractions, and the problem persists.

6 View the MySQL log file and find the following error if the MySQL database under Linux is connected through the client tool:

Host ' 192.168.2.109 ' isn't allowed to connect to this MySQL server:

I signed in to MySQL from terminal with the same username password, but using Tomcat to log in with this user name password

Say host ' 192.168.2.109 ' is not allowed to connect to this MySQL server!

Inference should be that tomcat access to MySQL is done via 3306 ports, and the external machine accesses MySQL the same while terminal

Access to MySQL is internal to the server and does not require 3306 ports, so accessing MySQL is like local access and does not require

Special permissions.

Summary analysis, should be MySQL default does not allow any access, requires MySQL to open the appropriate permissions:

To give users access to the following steps:

1. Accessing the MySQL database under Linux native

[[email protected] ~]# mysql-u your username-p your password

When the database is connected, grant permissions to the native user so that it can access the MySQL
Mysql->grant all on * * to ' root ' @ ' 192.168.2.109 ' identified by ' 123456 ';

This means that users with IP 192.168.2.109 can remotely connect to all the tables in the database through the root user.

Second question:

The error says can not find BJXT. T_deadline This table, look at the data table later found that the BJXT library has T_deadline

This form. Later changes to the MySQL configuration file will be case sensitive removed, the problem solved.

The steps are as follows:

    1. First go to the my.cnf file to modify the MySQL configuration information:

Edit the/etc/my.cnf file and add the Lower_case_table_names=1 parameter under the [MYSQLD] section

(Note: Case sensitive for 0 o'clock, not sensitive for 1 o'clock case, default is 0)

This will solve!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.