31 | | = mysql 遠端登入方法 = |
| 31 | |
| 32 | 若出現以下錯誤 |
| 33 | {{{ |
| 34 | #!text |
| 35 | Caused by: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure |
| 36 | |
| 37 | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. |
| 38 | }}} |
| 39 | |
| 40 | 代表程式碼連線到 mysql 的設定方法有錯誤,通常是Mysql 只聽 localhost,但你讓他去連 your_ip ,導致出現這樣的訊息,解決方法就是 |
| 41 | |
| 42 | A. 連線到 local |
| 43 | {{{ |
| 44 | #!text |
| 45 | DBConfiguration.configureDB(conf, "com.mysql.jdbc.Driver", "jdbc:mysql://localhost/school", "waue", "wauenchc"); |
| 46 | }}} |
| 47 | |
| 48 | B. 讓mysql 可以遠端存取 |
| 49 | |
| 50 | = mysql 遠端存取方法 = |