This is a creation in Article, where the information may have evolved or changed. Go language connection MySQL database
PHP is fast to develop, but performance needs to be improved.
C and C + +? Not good at reading other people's code is difficult, not to mention their own writing.
Introduced by people, began to use the go language, development speed is relatively fast, performance is also good.
http://golang.org/
Recently need to connect MySQL database using go language,
The first reaction is to find the official package:
http://golang.org/pkg/database/
There are two package that don't seem to be a reliable one:
Sql:
Package SQL provides a generic interface around SQL (or sql-like) databases.
Driver
Package driver defines interfaces to be implemented by database drivers as used by package SQL.
Then go to the Go Project Dashboard and look for it, http://godashboard.appspot.com/.
There are several MySQL-related:
Gomysql-mysql Library for Go Lib
Gomysql-client-library-go MySQL Client Library Lib
Mymysql-mysql Client API written entirely in Go. Lib
GO-DBD-MYSQL-A MySQL driver implementation for go-dbi Lib
Go-dbi-a Database Abstraction API in the spirit of Perl DBI et al Lib
Go-mysql-mysql wrapper for Go CGO
Go-mysql-driver-a lightweight and fast mysql-driver for Go ' s Database/sql package lib
Libmysqlgo-another wrapper for the MySQL C API CGO
Mysql-connector-go-implements MySQL Wire Protocol lib
Mysqlgo-mysql Bindings CGO
Gomysql go-dbd-mysql go-dbi Go-mysql can't be installed ... Do not know is the environmental problem or what problem, did not look closely.
Gomysql-client-library and Libmysqlgo link to the 404 error page.
Mysql-connector-go link to 403 error page ...
Mysqlgo has defunct.
Mymysql and Go-mysql-driver installed successfully.
[Root@www go]# Go Run test.go
Zhao Tianhua
Zhao Tian 1 Renren
Mould 2 Renren
Looks good, very useful.
Disadvantages?
Rows. Scan, each col in the table needs a variable corresponding to it, the field is more than tired?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.