Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

MySQLµÄcµ÷ÓÃ


1. ¸½¼ÓÏîÒ»¶¨ ¼ÓÉÏlibmysql.lib¡£
2. include Ò»¶¨¼ÓÉÏ mysqlµÄinclude£¨ÒòΪҪÅÜÕâ¹Ø¼üÒ»¾ä
#include <mysql.h>£©
3  lib Ò»¶¨¼ÓÉÏ mysqlµÄlib
 
ºÃÁËÏÂÃæÊÇʵÀýºÍphpº¯Êý»ù±¾Ò»ÑùµÄ¡£±¾È˲»¿ÉÄܸøÄã·­ÒëÎĵµ£¬º¯Êý²»¶®×Ô¼º¿´¡£
#include
<windows.h>//ÓÃÕâ¸ö·½±ã£¬°üº¬winsock.hËùÒÔ°üº¬winsockÒ²¿ÉÒÔ
#include <iostream>
#include <mysql.h>
using namespace std;
int main( int argc, char * argv[] )
{
//ÕâÀàÐͱð´íÁË£¬¾ßÌå¿´Îĵµ
 MYSQL mysql;
 MYSQL *pdata;
 MYSQL_RES
*result;   
 MYSQL_ROW
row;   
 char sqlcommand[80];
 mysql_init(&mysql);//Ò»¸ö³õʼ»¯
 mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"Gamer");
//¿ØÖÆÁ´½ÓÐÐΪµÄ
 pdata=mysql_real_connect(&mysql,"localhost","root","123456","gamer",0,NULL,0);
//Êý¾Ý¿âÁ´½Ó
 if(pdata)
 {
  cout<<"connect
successful!!"<<endl;
 }
 if(mysql_select_db(pdata,"gamerdata"))
 {
  cout<<"select_db
successful!!"<<endl;
 }
//È»ºóÑ¡ÔñÊý¾Ý¿âÁË£¬µ±È»ÓÃsqlÒ»Ñù£¬º¯Êý¿´×Å·½±ãµã
 sprintf(sqlcommand,"select * from
gamerdata");   
 
 mysql_query(pdata,sqlcommand);
//Õâ¾ä¸ÉʲôµÄ²»ÓÃÎÒ·Ñ´½ÉàÁË
 result =
mysql_use_result(pdata);
//»ñÈ¡¼Ç¼¼¯
 row = mysql_fetch_row(result);
//°´Êý×鷽ʽ°ÑÊý¾Ý·Åµ½rowÖУ¬µ±Ç°ÐеÄ
//¿´ËùÓÐÐмӸöÑ­»·¾ÍºÃ£¬Óαê×Ô¼º»áÅÜ£¬²»ÀÍ´ó¼Ò·ÑÐÄ¡£
 cout<<row[1];
//¿ÉÒÔÊä³öÁË£¬´ó¹¦¸æ³É
 mysql_close(pdata);
//±ðÍüÁË¿ªµÆ£¬ÍüÁ˹صÆ
}


Ïà¹ØÎĵµ£º

PHP»·¾³ IIS+PHP+MYSQL»·¾³µÄ¼ÜÉè

ºÜ¾ÃûÓÐЩһЩÓÐÓô¦µÄµÄ¶«Î÷ÁË£¡½ñÌì¾Í²»ºúÂÒµÄд¶«Î÷ÁË!дһЩÓÐÓõ졵±È»Ç°ÌáÏÂÊǺܸÐлºÜ¶à¾­³£À´ÎÒ²©¿ÍµÄÅóÓÑһϣ¡¶àл´ó¼Ò£¡£¡£¡£¡£¡
½ñÌìдµÄÊǹØÓÚphp»·¾³¼ÜÉèµÄµÚÒ»ÖÖ·½Ê½£¡µ±È»ÎҾͲ»½ØÍ¼ÁË£¡´ó¼ÒÖ»Òª°´ÕÕ²Ù×÷¾Í¿ÉÒÔʵÏֵģ¡
Ò»¡¢°²×° PHP £º±¾ÎÄPHP°²×°Â·¾¶È¡ÎªD:\php\php4\(Ϊ±Ü»ìÏý£¬PHP5.1.x°æ±¾°²×°Â·¾ ......

ÐÞ¸ÄmysqlÊý¾Ý¿âµÄĬÈϱàÂ뷽ʽ


< type="text/javascript">
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
var text = clipboardData.getData("text");
......

Mysql ´íÎó×ܽá

/***************************by
garcon1986********************************/
1.´´½¨±í¸ñʱ´íÎó£º ERROR 1005: Can't
create table (errno: 150)
 Õâ¸ö´íÎóÊÇÓÐÓÉÓÚÖ÷±íºÍÒýÓñíµÄÍâ¼ü¹ØÁª×ֶζ¨Òå²»Ò»ÖÂÒý·¢µÄ¡£
¼ì²éÁ½¸ö±íµÄ¹ØÁª×Ö¶ÎÊÇ·ñÀàÐͱàÂëÍêȫһÖ¡£
 ÁíÍ⻹ÓÐÒ»ÖÖ¿ÉÄܾÍÊǹØÁª×Ö¶ÎÔÚÒýÓñíÖÐ ......

MySQLÖ¸Áî

Ò»¡¢Á¬½ÓMYSQL¡£
¸ñʽ£º mysql -hÖ÷»úµØÖ· -uÓû§Ãû £­pÓû§ÃÜÂë
1¡¢Á¬½Óµ½±¾»úÉϵÄMYSQL¡£Ê×ÏÈ´ò¿ªDOS´°¿Ú£¬È»ºó½øÈëĿ¼mysql\bin£¬ÔÙ¼üÈëÃüÁîmysql -u root -p£¬»Ø³µºóÌáʾÄãÊäÃÜÂë.×¢ÒâÓû§Ãûǰ¿ÉÒÔÓпոñÒ²¿ÉÒÔûÓпոñ£¬µ«ÊÇÃÜÂëǰ±ØÐëûÓпոñ£¬·ñÔòÈÃÄãÖØÐÂÊäÈëÃÜÂë. Èç¹û¸Õ°²×°ºÃMYSQL£¬³¬¼¶Óû§rootÊÇûÓÐÃÜÂëµ ......

»ùÓÚSphinx+MySQLÈ«ÎļìË÷¼Ü¹¹Éè¼Æ

ǰÑÔ£º
±¾ÎIJûÊöµÄÊÇÒ»¿î¾­¹ýÉú²ú»·¾³¼ìÑéµÄǧÍò¼¶Êý¾ÝÈ«ÎļìË÷£¨ËÑË÷ÒýÇæ£©¼Ü¹¹¡£±¾ÎÄÖ»Áгöǰ¼¸ÕµÄÄÚÈݽÚÑ¡£¬²»ÌṩȫÎÄÄÚÈÝ¡£
ÔÚDELL PowerEdge 6850·þÎñÆ÷£¨ËÄ¿Å64 λInter Xeon MP 7110N´¦ÀíÆ÷ / 8GBÄڴ棩¡¢RedHat AS4 Linux²Ù×÷ϵͳ¡¢MySQL 5.1.26¡¢MyISAM´æ´¢ÒýÇæ¡¢key_buffer=1024M»·¾³ÏÂʵ²â£¬µ¥±í1000ÍòÌõ¼Ç ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ