从Golang API远程访问OVH SQL数据库

I'm making a Golang API to be able to interact with a SQL database from my Android application. The problem I have is the following:

I have a sql database hosted on https://phpmyadmin.ovh.net/

I'm trying to connect my locale API to this one. According to the documentation:

func Open(driverName, dataSourceName string) (*DB, error)

The driverName params would be "mysql" isn't it? But, what would be the dataSourceName params?

I saw lot of post about Open, however, I don't think I understand how to organize the url string about the dataSourceName params.

package main

import (
    "net/http"
    "database/sql"
    "fmt"
)

var db *sql.DB // global variable to share it between main and the HTTP handler

func main() {

fmt.Println("starting up")

db, err := sql.Open("mysql", "????????????")
if err != nil {
    fmt.Println("Error on initializing database connection: %s", err.Error())
}

err = db.Ping()
if err != nil {
    fmt.Println("Error on opening database connection: %s", err.Error())
}

http.HandleFunc("/", hello)
http.ListenAndServe(":8080", nil)
}

Thank for read & help !

/!\ EDIT /!\

So, after your both answers, I tried the code below:

package main

import (
"fmt"
"net/http"
"database/sql"
_ "github.com/go-sql-driver/mysql"
)

type databaseinfos struct {
user string
password string
name string
address string
port string
url string
}

var db *sql.DB // global variable to share it between main and the HTTP handler
var dbi *databaseinfos

func main() {

dbi := databaseinfos{
    user: "Emixam23",
    password: "",
    name: "mydb",
    address: "127.0.0.1",
    port: "3306",
    url: ""}
dbi.url = (dbi.user + ":" + dbi.password + "@tcp(" + dbi.address + ":" + dbi.port + ")/" + dbi.name)

fmt.Println(dbi.url)

db, err := sql.Open("mysql", dbi.url)
if err != nil {
    fmt.Println("Error on initializing database connection: %s", err.Error())
}

err = db.Ping()
if err != nil {
    fmt.Println("Error on opening database connection: %s", err.Error())
}

/*http.HandleFunc("/", hello)*/
http.ListenAndServe(":8080", nil)
}

However, I got an error which is "Error on opening database connection: %s dial tcp 127.0.0.1:3306: connectex: No connection could be made because the target machine actively refused it.".

Does the problem comes because of my computer or because of the dataSourceName params?

dataSourceName should be provided in the DSN format:

<username>:<password>@tcp(<host>:<port>)/<database>

For example:

db, err := sql.Open("mysql", "myuser:password@tcp(127.0.0.1:3306)/mydb")

There's a problem in your code, here:

dbi.url = (dbi.user + ":" + dbi.password + "@tcp(...

This way of building the connection string with the parameters I see above will result in:

Emixam23:@tcp...

With an empty password, which is wrong if we look at the spec:

[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]

We see that if no password is required you must not add the ":"

If the problem persists and the connection string actually matches the correct pattern, test that you can access your DB:

mysql -u Emixam23

or with password:

mysql -u Emixam23 -p

Then try to access the database to see if your user has the proper pemissions:

> USE mydb; SELECT 1;

If you can't even connect:

Check that your port and IP binding are correct:

sudo netstat -antp | grep mysql

If not, edit your /etc/mysql/my.cnf accordingly.