首页 > 数据库技术 > 详细

mysql_real_connect 参数注意

时间:2017-01-20 21:04:06      阅读:301      评论:0      收藏:0      [点我收藏+]

mysql_real_connect的声明:   

MYSQL *mysql_real_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long client_flag)


以下是官网的解释,其中对于NULL,empty string,empty string("")之间的区间需要格外注意:

If unix_socket is not NULL, the string specifies the socket or named pipe to use. Note that the host parameter determines the type of the connection.

in the mysql_real_connect() call, specify the “no-value” value for each parameter to be read from an option file:

  • For host, specify a value of NULL or the empty string ("").

  • For user, specify a value of NULL or the empty string.

  • For passwd, specify a value of NULL. (For the password, a value of the empty string in the mysql_real_connect() call cannot be overridden in an option file, because the empty string indicates explicitly that the MySQL account must have an empty password.)

  • For db, specify a value of NULL or the empty string.

  • For port, specify a value of 0.

  • For unix_socket, specify a value of NULL.

If no value is found in an option file for a parameter, its default value is used as indicated in the descriptions given earlier in this section.

    

本文出自 “点滴成长” 博客,请务必保留此出处http://xdataplus.blog.51cto.com/3614757/1893422

mysql_real_connect 参数注意

原文:http://xdataplus.blog.51cto.com/3614757/1893422

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!