Tuesday, May 14, 2019

MySQL Passwords

I'll never remember this unless I write it down here. And hey, maybe it will help somebody else.


  • MySQL version 8+
  • github.com/go-sql-driver/mysql
  • db, err = sql.Open("mysql", "username:password@/database")
    (no error)
  • query, err := db.Query("SELECT * FROM TABLE")
    this authentication plugin is not supported


mysql> alter user 'username'@'localhost' identified with mysql_native_password by 'password';

See also: https://github.com/go-sql-driver/mysql/issues/785