gcc ±àÒë¶àÏß³ÌÎļþºÍº¬MySqlÊý¾Ý¿â²Ù×÷Îļþ
gcc Ç¿´óµÄ±àÒëÆ÷¾Í²»×÷½éÉÜÁË
linuxÏÂÓÃgccÃüÁî±àÒë¶àÏß³ÌC³ÌÐòÎļþºÍº¬ÓÐMySqlÊý¾Ý¿â²Ù×÷Îļþ
1.±àÒë¶àÏß³ÌÎļþ
gcc -o mylti_thread.o multi_thread.c -lpthread
ÆäÖеÄmulti_thread.c±íʾԴÎļþ£¬mylti_thread.o±íʾ±àÒë²úÉúµÄÄ¿±êÎļþ£¬-lpthread±íʾÒýÈë¶àÏ߳̿⣬ÔÚ¡¶Using the GNU Compiler Collection¡·gcc 4.30 ÖйØÓÚ-lpthreadµÄÃèÊöÈçÏ£º
-lpthread Add support for multithreading using the POSIX threads library. This option sets flags for both the preprocessor and linker. It does not affect the thread safety of object code produced by the compiler or that of libraries supplied with it. These are HP-UX specific flags. Òª²»È»»á³öÏÖÀàËÆÒÔÏ´íÎó
/tmp/cc20DpmC.o: In function `main':
multi_thread.c:(.text+0x78): undefined reference to `pthread_create'
multi_thread.c:(.text+0xe2): undefined reference to `pthread_create'
multi_thread.c:(.text+0xf6): undefined reference to `pthread_join'
multi_thread.c:(.text+0x10a): undefined reference to `pthread_join'
2.±àÒëMySqlÊý¾Ý¿â²Ù×÷Îļþ
gcc -o sqltest.o sqltest.c -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
»òÕßgcc -o sqltest $(mysql_config --cflags) sqltest.c $(mysql_config --libs)
²Î¼ûÍøÖ· http://blog.163.com/zhangjinqing1234@126/blog/static/30730260200992251411161/
ÆäÖеÄsqltest.c±íʾԴÎļþ£¬sqltest.o±íʾ±àÒë²úÉúµÄÄ¿±êÎļþ£¬-I±íʾָ¶¨Í·ÎļþµÄĬÈÏËÑË÷·¾¶£¬-L±íʾָ¶¨ÒªÁ´½ÓµÄ¿â£¬Í¬ÉÏÃæ-l£¬¾ßÌå¿É²Î¼ûÍøÖ·
http://blog.csdn.net/zhulinfeiba/archive/2009/08/20/4464727.aspx
-IºóÃæµÄ²ÎÊý/usr/include/mysql¿ÉÄÜ»áÒòΪMySql°²×°µÄ·¾¶²»Í¬¶øÓÐËù¸Ä±ä£¬ÔÚÖÕ¶ËÊäÈ룺whereis mysql£¬½á¹ûÈçÏ£º
mysql: /usr/bin/mysql /etc/mysql /usr/lib/mysql /usr/include/mysql
/usr/share/mysql /usr/share/man/man1/mysql.1.gz
ÔÙcd /usr/include/mysql
£¬È»ºó ls
decimal.h my_dir.h mysqld_error.h sql_common.h
errmsg.h my_getopt.h mysql_embed.h &n
Ïà¹ØÎĵµ£º
ÎÒÓÐÒ»¸ö±í
CREATE TABLE `test1` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL,
`desc` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
£¨1£©ÒÔϲéѯ»á±¨´íÎó£º[Err] 1221 - Incorrect usage of UNION and ORDE ......
񡜧
CREATE TABLE `user` (
`id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(10) DEFAULT NULL,
`password` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
ÆäÖÐÓÐÊý¾ÝΪ£º
1 name1 123456
2&nbs ......
ÔÚMySQL 3.23.44°æ±¾ºó£¬InnoDBÒýÇæÀàÐ͵ıíÖ§³ÖÁËÍâ¼üÔ¼Êø¡£
Íâ¼üµÄʹÓÃÌõ¼þ£º
1.Á½¸ö±í±ØÐëÊÇInnoDB±í£¬MyISAM±íÔÝʱ²»Ö§³ÖÍâ¼ü£¨¾Ý˵ÒÔºóµÄ°æ±¾ÓпÉÄÜÖ§³Ö£¬µ«ÖÁÉÙÄ¿Ç°²»Ö§³Ö£©£»
2.Íâ¼üÁбØÐ뽨Á¢ÁËË÷Òý£¬MySQL 4.1.2ÒÔºóµÄ°æ±¾ÔÚ½¨Á¢Íâ¼üʱ»á×Ô¶¯´´½¨Ë÷Òý£¬µ«Èç¹ûÔÚ½ÏÔçµÄ°æ±¾ÔòÐèÒªÏÔʾ½¨Á¢£»
3.Íâ¼ü¹ØϵµÄÁ½¸ö± ......
½ñÌì¸ãÁËÒ»ÏÂÎ磬ÔÚµçÄÔÉϴÁËAPMƽ̨
ϵͳ:Windows7 Professional EN
Apache2.2.9:http://archive.apache.org/dist/httpd/binaries/win32/apache_2.2.9-win32-x86-openssl-0.9.8h-r2.msi
PHP5.3.1:http://windows.php.net/downloads/releases/php-5.3.1-Win32-VC6-x86.zip
MySQL5.1.42:http://ftp.iij.ad.jp/pub/db/ ......