Golang操作数据库遇到的问题记录
1.dial tcp 127.0.0.1:3306: connect: connection refused
- 确认mysql是否打开
- 移除/etc/my.cnf中的skip-networking
2.register db Ping default
, The authentication plugin is not supported.
mysql新版本(8.0以上)将root用户使用的plugin更新成caching_sha2_password,需要手动切换为mysql_native_password.
查看plugin
mysql> select host,user,plugin from mysql.user;
+-----------+------------------+-----------------------+
| host | user | plugin |
+<