C/C++¶ÔMySQL²Ù×÷
×òÌìÍíÉÏÔÚ¿´C/C++¶ÔÊý¾Ý¿âµÄ²Ù×÷,ÃÍÈ»¼ä¾õµÃÊ®·ÖÇ×ÇУ¬ÒòΪÆäÖкܶຯÊý¶¼ºÍPHPÖжÔMySQL²Ù×÷Ïàͬ£¬ÕâÊDzÅÏëÆðPHPÊÇCÑÝ»¯¶øÀ´µÄ¡£¾¹ýÒ»·¬µ·ÌÚ£¬ÖÕÓÚÍê³ÉÁËÒ»¸ö¼òµ¥µÄ³ÌÐò£¬µ«ÊÇÈÔÈ»´æÔÚ×ÅÒ»¸öÑÏÖصÄÎÊÌ⣬¾ÍÊÇ´ÓÊý¾Ý¿âÖеõ½µÄ½á¹ûÔÚÆÁÄ»ÉÏÏÔʾµÄÊÇÂÒÂ룬ºÜÈÃÈË·³¡£»¹Íû¸ßÊÖÃǴͽ̣¡
1.ÔÚ»úÆ÷ÉÏ×°ÉÏMySQL £¬¼ÙÉè°²×°ÔÚ C:\MySQL\ÖÐ;
2.ÕâÀïÎÒÃÇÓÃVC6.0À´±àдC++³ÌÐò£¬µ«ÊÇÕâ¸ö֮ǰҪ¶ÔVC6.0×öһЩÉèÖã¬Ò²¾ÍÊÇ°ÑMySQLĿ¼ÏµÄincludeºÍlibĿ¼°üº¬µ½VC6.0µÄdirectoryÑ¡ÏîÖС£¾ßÌåµÄ×ö·¨ÊÇÔÚVC6.0ÖÐ tools(¹¤¾ß)>>option(Ñ¡Ïî)>>directories(Ŀ¼)Õâ¸öÉèÖÃÖÐ°Ñ include files Ìí¼ÓÒ»¸ö·¾¶ C:\MySQL\include £¬ÔÙ¸ølibrary files Ìí¼ÓÒ»¸ö·¾¶C:\MySQL\lib\opt ,ÕâÑùÉèÖÃÒÔºóÄã¾ÍÄܹ»ÔÚ³ÌÐòÖÐÖ±½Óinclude¶ÔÊý¾Ý¿â²Ù×÷µÄÏà¹ØÍ·ÎļþÁË¡£
3.ÏÖÔÚ¿ÉÒÔ¿ªÊ¼Ð´³ÌÐòÁË£¬´úÂëÈçÏ£º
//===========================================================//
// TestMySQL.cpp
// Author : ASpire
// Discrb : for testing C++ in operating mysql
// Time : 2010-3-18
//===========================================================//
/* include header about mysql */
#include "winsock2.h"
#include "mysql.h"
#include <stdio.h>
#define CONN_HOST "localhost"
#define CONN_USER "user"
#define CONN_PWD "password"
#define CONN_DB "luntan"
//----------------------------------------------------------//
MYSQL mysql;
void exiterr(int exitcode)
{
fprintf(stderr,"%s",mysql_error(&mysql));
exit(exitcode);
}
int mysql_test()
{
MYSQL_RES *res;
MYSQL_ROW row;
unsigned int i = 0;
/* init mysql handler */
if(!mysql_init(&mysql))
{
exiterr(-1);
}
/* connect to mysql */
if(!mysql_real_connect(&mysql,CONN_HOST,CONN_USER,CONN_PWD,NULL,MYSQL_PORT,NULL,0))
{
exiterr(-2);
}
/* select db */
if(mysql_select_db(&mysql,CONN_DB))
{
exiterr(-3);
}
/* set db cha
Ïà¹ØÎĵµ£º
http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html
Sunday, May 10, 2009
Hadoop should target C++/LLVM, not Java (because of watts)
< type="text/javascript">
digg_url="http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html";
Over the years, ......
±àÕß°´
:·Ç³£»ù±¾¹ØÓÚCÓïÑÔµÄÎÊÌâ,Ò»¸öÐÅÏ¢Àà(¼ÆËã»ú,×ÊѶ¹¤³Ì,µç×Ó¹¤³Ì, ͨÐŹ¤³Ì)רҵµÄ±¾¿Æ±ÏÒµÉúÓ¦¸Ã´ïµ½µÄˮƽ¡£ÌâÄ¿²»ÄÑ,È«²¿¶¼ÄÜ¿ìËٵشðÍ꣬µ±È»Ò²ÐèÒªÒ»¶¨µÄ֪ʶ´¢±¸¡£
¶ÔÓÚ´ó¶àÊýÈË£¬ÎÒÃÇÔ¤ÆÚÄã¿ÉÄÜ´ð´í 3) 4) 15)Ì⣬ËùÒÔ´ð´í3µÀÒÔÄڵģ¬ÎÒÃÇÈÏΪÄãºÜ°ô
´ð´í5µÀÌâÒÔÄÚ£¬ÎÒÃÇÈÏΪÄ㻹²»´í(Ä ......
ʲôʱºòÐèÒª´´½¨Ï̳߳ØÄØ£¿¼òµ¥µÄ˵£¬Èç¹ûÒ»¸öÓ¦ÓÃÐèҪƵ·±µÄ´´½¨ºÍÏú»ÙỊ̈߳¬¶øÈÎÎñÖ´ÐеÄʱ¼äÓַdz£¶Ì£¬ÕâÑùÏ̴߳´½¨ºÍÏú»ÙµÄ´øÀ´µÄ¿ªÏú¾Í²»ÈݺöÊÓ£¬ÕâʱҲÊÇÏ̳߳ظóö³¡µÄ»ú»áÁË¡£Èç¹ûÏ̴߳´½¨ºÍÏú»Ùʱ¼äÏà±ÈÈÎÎñÖ´ÐÐʱ¼ä¿ÉÒÔºöÂÔ²»¼Æ£¬ÔòûÓбØҪʹÓÃÏ̳߳ØÁË¡£
ÏÂÃæÊÇ ......
¹ØÓÚ C/C++ º¯Êýµ÷ÓÃÔ¼¶¨£¬´ó¶àÊýʱºò²¢²»»áÓ°Ïì³ÌÐòÂß¼£¬µ«Óöµ½¿çÓïÑÔ±à³Ìʱ£¬Á˽âһϻ¹ÊÇÓкô¦µÄ¡£
VC ÖÐĬÈϵ÷ÓÃÊÇ __cdecl ·½Ê½£¬Windows API ʹÓà __stdcall µ÷Ó÷½Ê½£¬ÔÚ DLL µ¼³öº¯ÊýÖУ¬ÎªÁ˸ú Windows API ±£³ÖÒ»Ö£¬½¨ÒéʹÓà __stdcall ·½Ê½¡£
µ÷ÓÃÔ¼¶¨¸ú¶ÑÕ»Çå³ýÃÜÇÐÏà¹Ø¡£Èç¹ûдһ¸ö»ã±àº¯Êý£¬¸ø C/C++ ......
µÚÒ»ÖÖ·½·¨£º
rootÓû§µÇ¼ϵͳ
usr/local/mysql/bin/mysqladmin -u root -p password ÐÂÃÜÂë
enter password ¾ÉÃÜÂë
µÚ¶þÖÖ·½·¨£º
rootÓû§µÇ¼mysqlÊý¾Ý¿â
mysql> update mysql.user set password=password("ÐÂÃÜÂë")where User="root";
mysql> flush privileges;
mysql> quit ;
mysqlÍü¼ÇrootÃÜÂëÈçºÎ ......