lsc 5 months ago
parent
commit
3cfd67c82b
1 changed files with 6 additions and 1 deletions
  1. 6 1
      mysql.js

+ 6 - 1
mysql.js

@@ -8,6 +8,11 @@ var us = {
 us.mysqlconnection = function(host, database) {
     if (!us.sqle[host] || !us.sqle[host][database]) { //配置数据库连接 
         let port = host == '172.16.12.7' ? 3306 : 3306;
+        if(host == '123.58.32.152'){
+            port = 20330;
+        }else if(host == '123.58.32.151'){
+            port = 20007;
+        }
         // let port = host == '123.58.32.152' ? 20330 : 20007;
         us.sqle[host] = us.sqle[host] || {};
         us.sqle[host][database] = us.mysql.createPool({
@@ -15,7 +20,7 @@ us.mysqlconnection = function(host, database) {
             host: host, //数据库地址
             // host: '123.58.32.151', //数据库地址
             user: "root", //用户名
-            password: host == '172.16.12.7' ? "cocorobo" : "root", //密码
+            password: host == '127.0.0.1' ? "root" : "cocorobo", //密码
             database: database, //数据库名称
             // port: 20007 //端口
             port: port //端口