added mysql port to configuration

This commit is contained in:
printempw 2016-03-12 16:46:26 +08:00
parent ac8ae16786
commit 0827b2337b
3 changed files with 7 additions and 4 deletions

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-01-16 23:01:33
* @Last Modified by: printempw
* @Last Modified time: 2016-03-05 19:22:44
* @Last Modified time: 2016-03-12 16:44:47
*
* Create tables automatically
*/
@ -15,7 +15,7 @@ header('Content-type: text/html; charset=utf-8');
echo "<style>body { font-family: Courier, 'Microsoft Yahei', 'Microsoft Jhenghei', sans-serif; }</style>";
if (!file_exists("./install.lock")) {
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWD, DB_NAME);
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, DB_PORT);
echo "<h2>Blessing Skin Server 安装程序</h2>";

View File

@ -8,6 +8,9 @@ define('DB_USER', 'root');
/* MySQL 连接密码 */
define('DB_PASSWD', 'root');
/* MySQL 端口,默认 3306 */
define('DB_PORT', 3306);
/* MySQL 主机 */
define('DB_HOST', 'localhost');

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-02-02 21:59:06
* @Last Modified by: printempw
* @Last Modified time: 2016-03-06 13:41:24
* @Last Modified time: 2016-03-12 16:43:53
*/
class Database
@ -15,7 +15,7 @@ class Database
}
public static function checkConfig() {
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWD, DB_NAME);
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, DB_PORT);
if ($conn->connect_error) {
Utils::raise(-1, "Can not connect to mysql, check if database info correct in config.php. ".
$conn->connect_error);