我在默认的3306端口上从Linux连接MySQL(5.1.6)数据库,一切都很好:
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/wpdb" />
<property name="username" value="root" />
<property name="password" value="" />
Run Code Online (Sandbox Code Playgroud)
现在,我进入/etc/mysql/my.cnf并将默认端口更改为3307([client]和[mysqld])重新启动MySQL,调整hibernate连接url:
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3307/wpdb" />
<property name="username" value="root" />
<property name="password" value="" />
Run Code Online (Sandbox Code Playgroud)
并重新启动jboss.这次我无法连接:
08:22:05,276 WARN [org.hibernate.util.JDBCExceptionReporter] (MSC service thread 1-13) SQL Error: 0, SQLState: 08S01
08:22:05,276 ERROR [org.hibernate.util.JDBCExceptionReporter] (MSC service thread 1-13) Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
08:22:05,277 …Run Code Online (Sandbox Code Playgroud)