title: I can connect to my remote database via command line but not from golang, although local db works fine with both
body: <p>If I run the following from command prompt...</p>
  
  <pre><code>mysql -h xxx.xxx.xxx.xxx -u myuser -p mydb
  </code></pre>
  
  <p>I can access the database and successfully run a query from the sql> command prompt</p>
  
  <p>However, when I use the <code>database/sql</code> package in Golang get the following...</p>
  
  <blockquote>
    <p>[0/0]0x0Error 1045: Access denied for user
    'myuser'@'xxx.xxx.xxx.xxx' (using password: YES)</p>
  </blockquote>
  
  <p>Please see code below...</p>
  
  <pre><code>db, err := sql.Open("mysql", myuser:mypassword@tcp(xxx.xxx.xxx.xxx:3306)/mydb)
  
  if err != nil {
      color.Red(err.Error())
  }
  var objects []map[string]interface{}
  
  rows, err := db.Query("select * from mytable" , args...)
  if err != nil {
      return nil, err
  }
  </code></pre>
  
  <p>Please note the <code>db</code> var seems fine as if it connects to the database, it's when i try to populate the rows var i get the error.</p>
  
  <p>Also i created unit tests which create a database and table and test a query these all work fine.</p>
  
  <p>Al firewalls etc are off.</p>
  
  <p>so to summarise...</p>
  
  <blockquote>
    <p>Remote + Command Prompt -  works</p>
    
    <p>local + golang - is fine</p>
    
    <p>Remote + golang  - gets the error</p>
  </blockquote>