1.
Ç°ÑÔ
ÎÒʹÓõÄÖ÷»úÃûΪserver1.example.com
£¬ip
µØÖ·ÊÇ192.168.0.100
¡£ÕâЩÉèÖÿÉÄÜÓëÄãÏëÒªµÄÓÐËù²»Í¬£¬ËùÒÔÄã±ØÐëÔÚÊʵ±µÄµØ·½ÐÞ¸Äһϡ£
2
°²×°MySQL5
ÓÃÏÂÁÐÃüÁî°²×°MySQL
£º
yum install mysql mysql-server
È»ºóÎÒÃÇΪMySQL
´´½¨ÏµÍ³Æô¶¯Á´½Ó£¨ÕâÑùµÄ»°£¬MySQL
¾Í»áËæ×ÅϵͳÆô¶¯¶øÆô¶¯£©£¬²¢Æô¶¯MySQL
·þÎñÆ÷£º
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
ÔËÐÐ
mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword
À´Îªroot
Óû§ÉèÖÃÒ»¸öÃÜÂ루·ñÔòÈκÎÈ˶¼¿ÉÒÔ·ÃÎÊÄãµÄMySQL
Êý¾Ý¿â£¡£©
3
°²×°Apache2
Fedora
ĬÈÏÓÐApache2
Õâ¸ö°ü£¬ÎÒÃÇ¿ÉÒÔÓÃÏÂÁÐÃüÁî°²×°Ëü£º
yum install httpd
ÏÖÔÚÅäÖÃÏÂϵͳʹµÃApache
Äܹ»Ëæ×ÅϵͳÆô¶¯¶øÆô¶¯…
chkconfig --levels 235 httpd on
...
Æô¶¯Apache:
/etc/init.d/httpd start
ÏÖÔÚ´ò¿ªä¯ÀÀÆ÷£¬·ÃÎÊhttp://192.168.0.100
£¬Äã¾ÍÓ¦¸ÃÄÜ¿´µ½Apache2
µÄÔ¤ÁôÒ³ÁË£º
ÔÚFedora
ÖÐApache
µÄĬÈÏÎĵµÂ·¾¶ÔÚ/var/www/html
£¬ÅäÖÃÎļþÊÇ/etc/httpd/conf/httpd.conf
¡£ÆäÓàµÄÅäÖÃÎļþ´æ´¢Ô ......
1.
Ç°ÑÔ
ÎÒʹÓõÄÖ÷»úÃûΪserver1.example.com
£¬ip
µØÖ·ÊÇ192.168.0.100
¡£ÕâЩÉèÖÿÉÄÜÓëÄãÏëÒªµÄÓÐËù²»Í¬£¬ËùÒÔÄã±ØÐëÔÚÊʵ±µÄµØ·½ÐÞ¸Äһϡ£
2
°²×°MySQL5
ÓÃÏÂÁÐÃüÁî°²×°MySQL
£º
yum install mysql mysql-server
È»ºóÎÒÃÇΪMySQL
´´½¨ÏµÍ³Æô¶¯Á´½Ó£¨ÕâÑùµÄ»°£¬MySQL
¾Í»áËæ×ÅϵͳÆô¶¯¶øÆô¶¯£©£¬²¢Æô¶¯MySQL
·þÎñÆ÷£º
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
ÔËÐÐ
mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword
À´Îªroot
Óû§ÉèÖÃÒ»¸öÃÜÂ루·ñÔòÈκÎÈ˶¼¿ÉÒÔ·ÃÎÊÄãµÄMySQL
Êý¾Ý¿â£¡£©
3
°²×°Apache2
Fedora
ĬÈÏÓÐApache2
Õâ¸ö°ü£¬ÎÒÃÇ¿ÉÒÔÓÃÏÂÁÐÃüÁî°²×°Ëü£º
yum install httpd
ÏÖÔÚÅäÖÃÏÂϵͳʹµÃApache
Äܹ»Ëæ×ÅϵͳÆô¶¯¶øÆô¶¯…
chkconfig --levels 235 httpd on
...
Æô¶¯Apache:
/etc/init.d/httpd start
ÏÖÔÚ´ò¿ªä¯ÀÀÆ÷£¬·ÃÎÊhttp://192.168.0.100
£¬Äã¾ÍÓ¦¸ÃÄÜ¿´µ½Apache2
µÄÔ¤ÁôÒ³ÁË£º
ÔÚFedora
ÖÐApache
µÄĬÈÏÎĵµÂ·¾¶ÔÚ/var/www/html
£¬ÅäÖÃÎļþÊÇ/etc/httpd/conf/httpd.conf
¡£ÆäÓàµÄÅäÖÃÎļþ´æ´¢Ô ......
ÒÔÏÂΪOracleºÍMySQLÊý¾Ý¿âµÄһЩ¼òµ¥ÃüÁî¶Ô±È£¬¿´¿´ËüÃÇÖ®¼ä´æÔÚÄÄЩ²îÒì
¡¡¡¡SQL> select to_char(sysdate,'yyyy-mm-dd') from dual;
¡¡¡¡SQL> select to_char(sysdate,'hh24-mi-ss') from dual;
¡¡¡¡mysql> select date_format(now(),'%Y-%m-%d');
¡¡¡¡mysql> select time_format(now(),'%H-%i-%S');
¡¡¡¡ÈÕÆÚº¯Êý
¡¡¡¡Ôö¼ÓÒ»¸öÔ£º
¡¡¡¡SQL> select to_char(add_months(to_date ¡¡¡¡¡¡¡¡('20000101','yyyymmdd'),1),'yyyy-mm-dd') from dual;
¡¡¡¡½á¹û£º2000-02-01
¡¡¡¡SQL> select to_char(add_months(to_date('20000101','yyyymmdd'),5),'yyyy-mm-dd') from dual;
¡¡¡¡½á¹û£º2000-06-01
¡¡¡¡mysql> select date_add('2000-01-01',interval 1 month);
¡¡¡¡½á¹û£º2000-02-01
¡¡¡¡mysql> select date_add('2000-01-01',interval 5 month);
¡¡¡¡½á¹û£º2000-06-01
¡¡¡¡½ØÈ¡×Ö·û´®£º---
¡¡¡¡SQL> select substr('abcdefg',1,5) from dual;
¡¡¡¡SQL> select substrb('abcdefg',1,5) from dual;
¡¡¡¡½á¹û£ºabcdemysql> select substring('abcdefg',2,3);
¡¡¡¡½á¹û£ºbcd
¡¡¡¡mysql> select mid('abcdefg',2,3);
¡¡¡¡½á¹û£ºbcd
¡¡¡¡mysql> selec ......
ÒÔÏÂΪOracleºÍMySQLÊý¾Ý¿âµÄһЩ¼òµ¥ÃüÁî¶Ô±È£¬¿´¿´ËüÃÇÖ®¼ä´æÔÚÄÄЩ²îÒì
¡¡¡¡SQL> select to_char(sysdate,'yyyy-mm-dd') from dual;
¡¡¡¡SQL> select to_char(sysdate,'hh24-mi-ss') from dual;
¡¡¡¡mysql> select date_format(now(),'%Y-%m-%d');
¡¡¡¡mysql> select time_format(now(),'%H-%i-%S');
¡¡¡¡ÈÕÆÚº¯Êý
¡¡¡¡Ôö¼ÓÒ»¸öÔ£º
¡¡¡¡SQL> select to_char(add_months(to_date ¡¡¡¡¡¡¡¡('20000101','yyyymmdd'),1),'yyyy-mm-dd') from dual;
¡¡¡¡½á¹û£º2000-02-01
¡¡¡¡SQL> select to_char(add_months(to_date('20000101','yyyymmdd'),5),'yyyy-mm-dd') from dual;
¡¡¡¡½á¹û£º2000-06-01
¡¡¡¡mysql> select date_add('2000-01-01',interval 1 month);
¡¡¡¡½á¹û£º2000-02-01
¡¡¡¡mysql> select date_add('2000-01-01',interval 5 month);
¡¡¡¡½á¹û£º2000-06-01
¡¡¡¡½ØÈ¡×Ö·û´®£º---
¡¡¡¡SQL> select substr('abcdefg',1,5) from dual;
¡¡¡¡SQL> select substrb('abcdefg',1,5) from dual;
¡¡¡¡½á¹û£ºabcdemysql> select substring('abcdefg',2,3);
¡¡¡¡½á¹û£ºbcd
¡¡¡¡mysql> select mid('abcdefg',2,3);
¡¡¡¡½á¹û£ºbcd
¡¡¡¡mysql> selec ......
½ñÌìÓÃJPAÉú³ÉÊý¾Ý±í£¬ËäÈ»ÔÚEntityÉÏÒѾÅäÖúÃÁËÒ»¶Ô¶àºÍ¶à¶ÔÒ»µÄ¹Øϵ£¬×ÜÊÇÆæ¹Ö²»ÄÜÉú³ÉÍâ¼üË÷Òý¡£
ºóÀ´·¢ÏÖÊÇMySQLµÄ storage engine µÄÎÊÌâ¡£
ĬÈϵÄMyISAMÊDz»Ö§³ÖÍâ¼üµÄ¡£
Ö»ÓÐ¸Ä³É InnoDB²ÅÖ§³ÖÍâ¼ü
Ð޸ķ½·¨£¬ÕÒµ½ my.ini
ÔÚÀïÃæÌí¼Ó»òÐ޸ģ¨Èç¹ûÓеĻ°£©
default-storage-engine = InnoDB
¸½£º
MyISAMºÍInnoDBµÄÇø±ð
´æ´¢ÒýÇæ¸÷×ÔµÄһЩÌصã
ÉÏÃæÌáµ½µÄËÄÖÖ´æ´¢ÒýÇ涼Óи÷×ÔÊÊÓõĻ·¾³£¬ÕâÈ¡¾öÓÚËüÃǶÀÓеÄһЩÌØÕ÷¡£Ö÷ÒªÌåÏÖÔÚÐÔÄÜ¡¢ÊÂÎñ¡¢²¢·¢¿ØÖÆ¡¢²ÎÕÕÍêÕûÐÔ¡¢»º´æ¡¢ ¹ÊÕϻָ´£¬±¸·Ý¼°»Ø´æµÈ¼¸¸ö·½Ãæ
Ä¿Ç°±È½ÏÆÕ¼°µÄ´æ´¢ÒýÇæÊÇMyISAMºÍInnoDB.¶øMyISAMÓÖÊǾø´ó²¿·ÖWebÓ¦ÓõÄÊ×Ñ¡¡£MyISAMÓëInnoDBµÄÖ÷ÒªµÄ²»Í¬µãÔÚÓÚÐÔÄܺÍÊÂÎñ¿ØÖÆÉÏ¡£
MyISAMÊÇÔçÆÚISAM(Indexed Sequential Access Method,ÎÒÏÖÔÚÓõÄMySQL5.0ÒѾ²»Ö§³ÖISAMÁË£©µÄÀ©Õ¹ÊµÏÖ£¬ISAM±»Éè¼ÆΪÊʺϴ¦Àí¶ÁƵÂÊÔ¶´óÓÚдƵÂÊÕâÑùÒ»ÖÖÇé¿ö£¬Òò´ËISAMÒÔ¼°ºóÀ´µÄMyISAM¶¼Ã»Óп¼ÂǶÔÊÂÎïµÄÖ§³Ö£¬ÅųýÁËTPM£¬²»ÐèÒªÊÂÎñ¼Ç¼£¬ISAMµÄ²éѯЧÂÊÏ൱¿É¹Û£¬¶øÇÒÄÚ´æÕ¼ÓúÜÉÙ¡£MyISAMÔڼ̳ÐÁËÕâÀàÓŵãµÄͬʱ£¬Óëʱ¾ã½øµÄÌṩÁË´óÁ¿ÊµÓõÄÐÂÌØÐÔºÍÏà¹Ø¹¤¾ß¡£ÀýÈ翼Âǵ½²¢·¢¿ØÖÆ£¬ÌṩÁË±í¼¶Ëø£ ......
±¾ÎÄÕÂÔ´´ÓÚwww.yafeilinux.com תÔØÇë×¢Ã÷³ö´¦¡£
ÔÚÉÏÒ»½ÚµÄĩβÎÒÃÇÒѾ¿´µ½£¬ÏÖÔÚ¿ÉÓõÄÊý¾Ý¿âÇý¶¯Ö»ÓÐ3ÖÖ£¬ÄÇôÔõÑùʹÓÃÆäËûµÄÊý¾Ý¿âÄØ£¿ÔÚQtÖУ¬ÎÒÃÇÐèÒª×Ô¼º±àÒëÆäËûÊý¾Ý¿âÇý¶¯µÄ´úÂ룬ÈÃËüÃÇÒÔ²å¼þµÄÐÎʽÀ´Ê¹Óá£ÏÂÃæÎÒÃǾÍÒÔÏÖÔڱȽÏÁ÷ÐеÄMySQLÊý¾Ý¿âΪÀý£¬ËµÃ÷Ò»ÏÂÔõÑùÔÚQt CreatorÖÐÌí¼ÓÊý¾Ý¿âÇý¶¯²å¼þ¡£
ÔÚ½²Êö֮ǰ£¬ÎÒÃÇÏÈ¿´Ò»ÏÂQt CreatorÖÐÊý¾Ý¿âµÄ²å¼þµ½µ×·ÅÔÚÄÄÀï¡£
ÎÒÃǽøÈëQt CreatorµÄ°²×°Ä¿Â¼£¬È»ºó½øÈëÏà¶ÔÓ¦µÄÎļþ¼ÐÏ£¬±È·½ÎÒÕâÀïÊÇ
D:\Qt\2010.02.1\qt\plugins\sqldrivers
ÔÚÕâÀïÎÒÃÇ¿ÉÒÔ¿´¼û¼¸¸öÎļþ£¬ÈçÏÂͼ£º
¸ù¾ÝÃû×ÖÖеĹؼü×Ö£¬ÎÒÃÇ¿ÉÒÔÅжϳöÕâ¾ÍÊÇODBCÊý¾Ý¿âºÍSQLiteÊý¾Ý¿âµÄÇý¶¯²å¼þ¡£ÏÂÃæÎÒÃDZàÒëºÃMySQLÊý¾Ý¿âÇý¶¯ºó£¬Ò²»áÔÚÕâÀï³öÏÖÏà¶ÔÓ¦µÄÎļþ¡£
Ê×ÏÈ£ºÎÒÃDz鿴ÔõÑù°²×°Êý¾Ý¿â²å¼þ¡£
ÎÒÃÇ´ò¿ªQt Creator£¬ÔÚ°ïÖúÖÐËÑË÷SQL Database Drivers¹Ø¼ü×Ö¡£ÕâÀïÁгöÁ˱àÒëQtÖ§³ÖµÄËùÓÐÊý¾Ý¿âµÄÇý¶¯µÄ·½·¨¡£
ÎÒÃÇÏÂÀµ½ÔÚwindowsÉϱàÒëQMYSQLÊý¾Ý¿â²å¼þµÄ²¿·Ö£¬ÆäÄÚÈÝÈçÏ£º
ÕâÀïÏêϸ½éÉÜÁËÕû¸ö±àÒëµÄ¹ý³Ì£¬Æä¿ÉÒÔ·ÖΪÒÔϼ¸²½£º
µÚÒ»£¬ÏÂÔØMySQLµÄ°²×°³ÌÐò£¬ÔÚ°²×°Ê±Ñ¡Ôñ¶¨ÖÆ°²×°£¬ÕâʱѡÖа²×°LibsºÍIncludeÎļþ¡£°²×°Î»Ö ......
°²×°JDBCÇý¶¯£º
½âѹËõmysql-connector-java-3.1.10.zip
½«ÒªÊ¹ÓõÄÊÇmysql-connector-java-3.1.10-bin-g.jarºÍmysql-connector-java-3.1.10-bin.jar
ÅäÖÃ
ÔÚC:\Program Files\JavaĿ¼Ï½¨Á¢mysqlforjdbc×ÓĿ¼£¬½øÈë¸ÃĿ¼½«mysql-connector-java-3.1.10-bin.jarµ½¸ÃĿ¼ÏÂ
½øÈëC:\Program Files\Java\jdk1.5.0_04\libĿ¼½«mysql-connector-java-3.1.10-bin-g.jar¿½±´µ½¸ÃĿ¼ÏÂ
È»ºóÅäÖÃclasspath£¬×·¼Ó%JAVA_HOME%\lib\mysql-connector-java-3.1.10-bin-g.jar;C:\Program Files\Java\mysqlforjdbc\mysql-connector-java-3.1.10-bin.jar;µ½¸Ã»·¾³±äÁ¿ÖÐÈ¥
×·¼ÓÒÔºó»·¾³±äÁ¿ÈçÏ£º
CLASSPATH=%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;C:\Program Files\Apache Software Foundation\Tomcat5.5\common\lib\servlet-api.jar;%JAVA_HOME%\lib\mysql-connector-java-3.1.10-bin-g.jar;C:\Program Files\Java\mysqlforjdbc\mysql-connector-java-3.1.10-bin.jar;
ÅäÖÃÕâ¸öµÄÄ¿µÄÊÇÈÃjavaÓ¦ÓóÌÐòÕÒµ½Á¬½ÓmysqlµÄÇý¶¯£®
²é¿´²¢Æô¶¯MySQL·þÎñ
ÔÚWindows XPÏ°²×°ÍêMySQLºó£¬Ëü¾ÍÒѾ×Ô¶¯Æô¶¯·þÎñÁË£¬²¢ÇÒÔÚ¿ªÊ¼²Ëµ¥ÖÐÓÐÆä¿Í»§¶ËµÄ¿ì½Ý·½Ê½Á¬½Ó
¿ÉÒÔͨ¹ýWindo ......
×î½üÔÚѧϰtomcat+mysql¿ª·¢web£¬ÔÚ°²×°ºÍжÔØmysqlµÄ¹ý³ÌÖÐÓöµ½ÁËһЩÎÊÌ⣬ÕÛÌÚÁËÎҺü¸Ìì¡£ÔÚÕâÀï¸ø´ó¼Ò½ÌÒ»ÏÂÍêÕûµÄжÔØmysqlµÄ¹ý³Ì¡£
ÓÐʱºò֮ǰ°²×°¹ýmysqlжÔغóÓÖÖØа²×°µÄ¹ý³ÌÖУ¬°²×°ºÃµÄmysql½ø²»È¥£¬ÈÃÈ˾õµÃºÜÐÄ·³£¬×Ô¼ºÒѾжÔØÁË£¬ÖØÐÂ×°Á˺óΪʲô½ø²»È¥ÄØ¡·£¿£¿ ÔÒòÊÇжÔعý³Ì²¢²»ÍêÕû¡£ÎҰѹý³ÌÖзÖΪÒÔϼ¸¸ö¹ý³Ì¡£
1£ºµ½¿ØÖÆÃæ°å———Ìí¼Ó»òɾ³ý³ÌÐòÀïÕÒµ½mysqlÑ¡ÔñжÔØ£»
2£º°ÑÕâ¸öÎļþҲɾ³ýÁËX:\Program Files\MySQL£¬¾ÍÊÇ°ÑÕâ¸öĿ¼Ҳɾ³ýÁË£»
3£ºÏÂÃæÒ²¾ÍÊÇ×îÖØÒªµÄÒ»µã£¬Ò²ÊÇÈúܶàÈËÀ§»óµÄÒ»µã¡£ÆäʵmysqlµÄ°²×°¹ý³ÌÖÐÒѾÔÚÕâ¸öĿ¼ĬÈÏÁËÒ»¸ömysqlÎļþ£»
ÔÚX:\Documents and Settings\All Users\Application DataÔÚÕâ¸öĿ¼Ï»¹ÓÐÒ»¸ömysqlÎļþ£¬°ÑÕâҲɾ³ýÁË£¬Õâ¾ÍÍêÃÀжÔØÁË¡£
½ÓÏÂÀ´Äã¾ÍÄÜÖØа²×°ÄãµÄmysqlÁË£¬È»ºó½øÐÐÅäÖá£
ºÙºÙ£¬×£ÄãÃdzɹ¦¡£ ÎÒÊǸö´ó²ËÄñ£¬Ï£ÍûÄÜ°ïÖúµ½Ò»Ð©ºÍÎÒÒ»ÑùµÄ²ËÄñ£¬ÉÙ×ßÍä·£¬ÎÒ×ßÁË£¬Äã¾Í²»ÒªÁË£¡£¡ ......