|
|
@ -22,7 +22,7 @@ import ( |
|
|
|
|
|
|
|
//存在所有对象信息 - 集合
|
|
|
|
func main() { |
|
|
|
sqlPath := "D:/hy_qggwy_kk.sql" |
|
|
|
sqlPath := "./hy_qggwy_kk.sql" |
|
|
|
|
|
|
|
db, _ := sql.Open("mysql", "root:admin@tcp(127.0.0.1:35017)/hy_qggwy?charset=utf8") |
|
|
|
log.Print("操作数据库连接:", db) |
|
|
@ -128,7 +128,7 @@ func runSQL(mysqlPath, sqlPath string) { |
|
|
|
log.Print("调用执行对应的SQL脚本:", sqlPath) |
|
|
|
c := exec.Command("cmd", "/C", mysqlPath+"mysql -uroot -padmin hy_qggwy < "+sqlPath) |
|
|
|
if err := c.Run(); err != nil { |
|
|
|
log.Fatal("执行时发生异常!异常为:", err) |
|
|
|
log.Print("【不影响执行】执行时发生异常!异常为:", err) |
|
|
|
} |
|
|
|
log.Print("预置脚本数据成功!") |
|
|
|
} |
|
|
|