InMysql databaseFor standard servlet/tomcat network applications in the background, there is a problem when they are used again after one day of standby, and the First Login always fails. Check the log and find the following error: "com. mysql. jdbc. exceptions. jdbc4.CommunicationsException: Communications link failure ".
The above problem is caused by mysql5Database Configuration. Mysql5 sets the connection wait time (wait_timeout) to 8 hours by default.
- mysql show global variables like 'wait_timeout';
-
- +---------------+---------+
-
- | Variable_name | Value |
-
- +---------------+---------+
-
- | wait_timeout | 28800 |
-
- +---------------+---------+
-
- 1 row in set (0.00 sec)
Solution:
A. Add or modify 'wait _ timeout' in the my. cnf or my. ini file'
[Mysqld]
Wait_timeout = 1814400
B. Restart mysql5
Mysql Character Set problems:
A. Go to mysql and query the character set
Shell> show variables like ''character %''
B. Modify the default Character Set of the database to utf8.
Find [mysqld] or [mysql] In my. conf (linux path =/etc) or my. ini (windowns), modify or add the following lines:
Default_character_set = utf8.
C. Restart the mysql service. The modification is successful.
This article describes how to solve the logon Failure error caused by MySQL Database Configuration and modify the character set. We hope this article will help you.