A small example of MySQL C programming in Linux-Linux general technology-Linux programming and kernel information. for details, see the following. To include the header file mysql. h
MYSQL * conn;
MYSQL_RES * res;
MYSQL_ROW row;
Char * server = "localhost ";
Char * user = "root ";
Char * password = "123456 ";
Char * database = "sam ";
Boycott 18:38:36
// Save http packet info
Conn = mysql_init (NULL );
/* Connect to database */
If (! Mysql_real_connect (conn, server, user, password, database, 0, NULL, 0 ))
{
Fprintf (stderr, "% s \ n", mysql_error (conn ));
Return;
}
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.