title: Golang MySQL Database Not Selected
body: <p>I'm using <code>github.com/go-sql-driver/mysql</code> package to connect to MySQL. It works well except when I select a database (<code>USE</code>), I can't run queries against it.</p>
  
  <pre><code>package main
  
  import (
      "database/sql"
      "fmt"
      "log"
  )
  
  import _ "github.com/go-sql-driver/mysql"
  
  func main() {
      dsn := "root:@/"
      db, err := sql.Open("mysql", dsn)
      if err != nil {
          fmt.Println("Failed to prepare connection to database. DSN:", dsn)
          log.Fatal("Error:", err.Error())
      }
  
      err = db.Ping()
      if err != nil {
          fmt.Println("Failed to establish connection to database. DSN:", dsn)
          log.Fatal("Error:", err.Error())
      }
  
      _, err = db.Query("USE test")
      if err != nil {
          fmt.Println("Failed to change database.")
          log.Fatal("Error:", err.Error())
      }
  
      _, err = db.Query("SHOW TABLES")
      if err != nil {
          fmt.Println("Failed to execute query.")
          log.Fatal("Error:", err.Error())
      }
  }
  </code></pre>
  
  <p>The program produces this output:</p>
  
  <p><code>Error 1046: No database selected</code></p>