VCÖÐÓÃADO²Ù×÷MySqlÊý¾Ý¿âÖÐÎÄÎÊÌâ
ÎҵijÌÐòÊÇÓÃADOÀ´Á¬½ÓMysqÊý¾Ý¿âµÄ£¬ÕâÊÇÔÏÈдºÃÓÃÔÚMSSQLÉϵ쬏ÄÁËÏÂÁ¬½Ó×Ö·û´®£¬ËùÒÔÒ²¾ÍûÓÐÓÃMySql C++ APIÀ´ÖØÐÂдÁË¡£¸Õ¿ªÊ¼Ê¹ÓÃMySql£¬Óöµ½µÄÎÊÌâ×ÜÊÇÌØ±ðµÄ¶à£¬ÏÖÔÚÓÖÓöµ½Ò»¸öÖ÷Òªsql×Ö·û´®ÖÐÓÐÖÐÎľͱ¨´íµÄÎÊÌ⣬ûÓÐÖÐÎÄÒ»ÇÐÕý³££¬ÕûÕûŪÁËÒ»¸öÉÏÎ磬ÔÚÍøÉÏÒ²ÕÒÁ˺ܶà×ÊÁÏ£¬·¢ÏÖÍøÉϺܶණÎ÷ȷʵÊÇÔÚÃÉÈË£¬°´ËûÃǵķ½·¨À´½á¹û¶¼ÊÇÒ»ÑùµÄ£¬»¹ÊÇ´íÎó¡£
ÏÖÔÚÖÕÓÚ°ÑÎÊÌâ¸ã¶¨ÁË£¬¹²ÏíÏÂ×Ô¼ºµÄѧϰ¾Ñé°É¡£
ÓÃADOÁ¬½ÓMySqlÊý¾Ý¿âÒªÏë±ÜÃâÖÐÎÄÂÒÂëµÈÎÊÌ⣬Ê×ÏÈÒª±£Ö¤Êý¾ÝÑ¡ÓõıàÂë¸ñʽΪGBK(ÕâÊÇÐí¶àǰ±²Ãǽ¨ÒéµÄ£¬Õâ¸ö×Ö·û¼¯Ö§³ÖµÄ±È½Ï¶à)£¬¶øÇÒÔÚMySqlÖл¹¿ÉÒÔÉèÖñíµÄ£¬×ֶεıàÂë¸ñʽ¡£
Æä´Î£¬ÔÚAD£ÏÁ¬½Ó´úÂëÖÐ×ö±ØÒªµÄÉèÖ㬾ßÌåÉèÖÃÈçÏ£º
try
{
//ÉèÖÃADOʹÓõÄ×Ö·û¼¯
myConn->Execute("set character_set_connection=gbk",NULL,adCmdText);
myConn->Execute("set character_set_results=gbk",NULL,adCmdText);
myConn->Execute("set character_set_client=gbk",NULL,adCmdText);
myConn->Execute(_bstr_t(sqlText),NULL,adCmdText);
}
catch (_com_error e)
{
msg = e.ErrorMessage();
}
Á½·½Ãæ¶¼±£Ö¤ÁËÒÔºóÎÊÌâÓ¦¸Ã¾Í¿ÉÒԸ㶨ÁË£¬²»¹ýÎÒÏë²¢²»Ò»¶¨Ò»¶¨ÒªÊ¹Óãǣ£ˣ¬Äܱ£Ö¤Á½±ßµÄ±àÂë¸ñʽһÖÂÓ¦¸Ã¾ÍÐС£
Ïà¹ØÎĵµ£º
1.±³¾°
֮ǰ´ÓûÓùýhibernate£¬Òò´ËÔÚÍøÉÏËÑÁËÒ»ÏÂhibernate¿ìËÙÈëÃÅ·½ÃæµÄÐÅÏ¢£¬×îºóÎÒ°´ÕÕ¡¶Myeclipse Hibernate ¿ìËÙÈëÃÅ ÖÐÎİ桷£¨CSDN£¬°Ù¶ÈÎĿⶼÓУ©Ò»ÎÄ¿ªÊ¼ÁËÎÒµÄhibernateÖ®Âã¨ÎªÏîÄ¿×ö¼¼Êõ×¼±¸£©¡£
ÏÂÃ ......
MySQL showµÄÓ÷¨
a. show tables»òshow tables from database_name; // ÏÔʾµ±Ç°Êý¾Ý¿âÖÐËùÓбíµÄÃû³Æ
b. show databases; // ÏÔʾmysqlÖÐËùÓÐÊý¾Ý¿âµÄÃû³Æ
c. show columns from table_name from database_name; »òshow columns from database_name.table_name; ......
windows주
½â¾ö°ì·¨£º
1.¼ì²éÄãµÄMysqlĿ¼ÓÐûÓиøÏµÍ³µÄSystemÓû§È¨ÏÞ¡£
2.ɾ³ýµôÄãµÄ %WINDOWS%/my.ini Îļþ¡£
3.¼ì²éÄãµÄ c:/my.cnf ÎļþÅäÖÃÊÇ·ñÕýÈ·¡£
ÐÞ¸Ä%windir%\my.ini£¬Ôö¼Ó
[mysqld]
#ÉèÖÃbasedirÖ¸ÏòmysqlµÄ°²×°Â·¾¶
basedir=D:\Program\Tools\mysql
datadir=D:\Program\Tools\mysql\data& ......
ÃüÁʽµÄ.×¢ÒâÿÐкó±ß¶¼¸ú¸ö £» ±íʾһ¸öÃüÁîÓï¾ä½áÊø.
¸ñʽ£ºgrant select on Êý¾Ý¿â.* to
Óû§Ãû@µÇ¼Ö÷»ú identified by "ÃÜÂë"
Àý1¡¢Ôö¼ÓÒ»¸öÓû§test1ÃÜÂëΪabc£¬ÈÃËû¿ÉÒÔÔÚÈκÎÖ÷»úÉϵǼ£¬²¢¶ÔËùÓÐÊý¾Ý¿âÓвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾³ýµÄȨÏÞ¡£Ê×ÏÈÓÃÒÔ
rootÓû§Á¬ÈëMYSQL
£¬
È»ºó¼üÈëÒÔÏÂÃüÁ
gr ......