mirror of
https://github.com/acepanel/panel.git
synced 2026-02-05 05:47:17 +08:00
fix: mysql包含特殊字符连接失败
This commit is contained in:
@@ -3,7 +3,6 @@ package db
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"slices"
|
||||
|
||||
@@ -20,8 +19,6 @@ type MySQL struct {
|
||||
}
|
||||
|
||||
func NewMySQL(username, password, address string, typ ...string) (*MySQL, error) {
|
||||
username = url.QueryEscape(username)
|
||||
password = url.QueryEscape(password)
|
||||
dsn := fmt.Sprintf("%s:%s@tcp(%s)/", username, password, address)
|
||||
if len(typ) > 0 && typ[0] == "unix" {
|
||||
dsn = fmt.Sprintf("%s:%s@unix(%s)/", username, password, address)
|
||||
|
||||
Reference in New Issue
Block a user