Added MySQL Config

This commit is contained in:
Luke Else 2022-01-23 15:23:37 +00:00
parent 6437132350
commit fe1205dff1
2 changed files with 6 additions and 3 deletions

2
go.mod
View File

@ -2,4 +2,4 @@ module DataInputClient
go 1.17 go 1.17
require github.com/go-sql-driver/mysql v1.6.0 // indirect require github.com/go-sql-driver/mysql v1.6.0

View File

@ -5,6 +5,8 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"os" "os"
_ "github.com/go-sql-driver/mysql"
) )
func main() { func main() {
@ -18,10 +20,11 @@ func main() {
fmt.Println(string(jsonString), x) fmt.Println(string(jsonString), x)
//Open a connection to the database //Open a connection to the database
db, err := sql.Open("mysql", "") db, err := sql.Open("mysql", "root:@tcp(:3306)/EFB")
if err != nil { if err != nil {
fmt.Println(err)
} }
defer db.Close()
//Make a Query to the database //Make a Query to the database
db.Exec("INSERT INTO ") db.Exec("INSERT INTO ")
//Close the connection //Close the connection