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

MySQLÖ÷´Ó·þÎñÆ÷µÄһЩ¼¼ÇÉ(ת)

Ö÷´Ó·þÎñÆ÷±íÀàÐ͵ÄÑ¡Ôñ
Ò»°ãµÄ¹²Ê¶ÊÇÖ÷·þÎñÆ÷ʹÓÃinnodb£¬ÊÂÎñ£¬ÐÐËøµÈ¹¦ÄÜÊÇmyisamËùûÓеģ¬¶ÔÐ޸IJÙ×÷¶øÑÔ£¬Ëü¸ü¸ßЧ£»´Ó·þÎñÆ÷ʹÓÃmyisam£¬È«ÎļìË÷¹¦ÄÜÊÇinnodbËùûÓеģ¬¶Ô²éѯ²Ù×÷¶øÑÔ£¬Ëü¸ü¸ßЧ¡£ÕâÑù¾Í¿ÉÒÔ¸÷¾¡ÆäÄÜ¡£
ºÇºÇ£¬Ö÷´Ó¿â¸÷˾ÆäÖ°£¬Ö÷¿â£º×î¿ìµÄËÙ¶È×öÌí¼Óɾ³ýÐ޸IJÙ×÷£¬´Ó¿â£¬×î¿ìµÄËÙ¶È×ö²éѯ²Ù×÷
ÎÊÌ⣺Ö÷´Ó·þÎñÆ÷×Ö¶ÎÀàÐ͵ÄÑ¡Ôñ
×Ö¶ÎÀàÐͶÔÓÚ·ÖÒ³µÈ²Ù×÷ÓкܴóÓ°Ïì¡£Ö÷·þÎñÆ÷Ò»°ãÊÇinnodb£¬ÒòΪ²»Éæ¼°²éѯ£¬ËùÒÔ¿ÉÒÔʹÓÃvarcharµÈÀ´´æ´¢×Ö·û´®À´½ÚÊ¡¿Õ¼ä£¬´Ó·þÎñÆ÷Ò»°ãÊÇ myisam£¬ÒòΪÉæ¼°²éѯ£¬ËùÒÔ±ØÐëÔÚcharºÍvarcharÖ®¼ä×ÐϸȨºâ£¬Ã»ÓÐvarchar, text, blob×ֶεıíÊǾ²Ì¬±í£¬·´Ö®ÊǶ¯Ì¬±í£¬¾²Ì¬±íµÄ¼ìË÷ЧÂÊÒª±È¶¯Ì¬±íºÃÈô¸É±¶£¬Ò»°ãÀ´Ëµ£¬ËùÓÐÉæ¼°´ó½á¹û¼¯µÄ²éѯ¶¼Ó¦¸Ã¾¡¿ÉÄܱ£Ö¤ÔÚ¾²Ì¬±íÉÏÍê³É£¬ÕâÀï ˵һ¸öÀý×Ó£º±ÈÈç˵³£¼ûµÄarticles±íÓÐtitle(varchar), body(text)µÈ×ֶΣ¬ÔÚ×öÎÄÕÂÁбíµÄʱºò£¬ÒòΪ²»ÊǾ²Ì¬±í£¬ËùÒÔ²éѯ²»»áºÜ¿ì£¬ÏÂÃ濪ʼÖع¹½â¾ö·½°¸£º°ÑÔ­À´µÄarticles±í²ð·Ö³É subjects±íºÍcontents±í£¬title×Ö¶ÎÉèÖÃΪһ¸ö×ã¹»µÄcharÀàÐÍ·ÅÔÚsubjects±íÀbody×ֶλ¹±£³ÖÊÇtextÀàÐͷŵ½ contents±íÀsubjectsºÍcontents±íÖ®¼äµÄ¹ØϵÊÇÒ»¶Ô¶à£¬ÕâÑù£¬Ë³´ø×ÅÒ²·½±ãµÄʵÏÖÁ˶àÒ³ÎÄÕµĹ¦ÄÜ£¬¶øÇÒ¸üÖØÒªµÄÊÇÔÚ²éѯÎÄÕ ÁбíµÄʱºò£¬²Ù×÷¶¼ÊÇÔÚsubjects¾²Ì¬±íÀïÍê³É£¬Ð§Âʿ϶¨»á±ÈÇ°Ò»ÖÖ·½°¸ÌáÉýºÜ¶à¡£
Ç¿µ÷£ºMyISAMÀᄇ̬±íºÍ¶¯Ì¬±íµÄÇø±ð¶ÔÐÔÄÜÓ°Ï켫´ó£¬µ«ÎÒ¸Ò˵ºÜ´óÒ»²¿·ÖʹÓÃÕß²¢Ã»ÓÐ×¢Òâ¹ýÕâÒ»µã£¡Èç¹ûÄã¾ÍÊÇÆäÖÐÖ®Ò»£¬ÄÇôÎÒÇ¿ÁÒ½¨ÒéÄãÔÙ´ÎÌå»á Ò»ÏÂÇ°Ãæ˵µÄarticles·Ö½âΪsubjects/contentsµÄ¹ý³Ì£¬ÏàÐÅÄãÊìϤÁËÒÔºó£¬ÏÂÒ»¸öÓ¦ÓõÄËٶȻáÓÐÖʵÄÌáÉý¡£
°¦£¬ÎÒ¾ÍÊÇÄDz»ÖªµÀµÄµ±ÖÐÒ»ÈË£¬ÊܽÌÁË
ÎÊÌ⣺Ö÷´Ó·þÎñÆ÷NOW()º¯ÊýÔì³ÉÊý¾Ý²»Ò»ÖÂ
¼ÙÉèÔÚÖ÷·þÎñÆ÷ÉÏÖ´ÐÐÒ»ÌõINSERT …. VALUES ( …, NOW())£¬ÄÇôÔÚ´Ó·þÎñÆ÷ÉÏÒ²»áͬÑùÖ´ÐÐÒ»ÌõµÄSQLÓï¾ä£¬µ«ÊÇÖ÷´Ó·þÎñÆ÷¸÷×ÔµÄʱ¼äÉèÖÿÉÄܲ»Ò»Ö£¨±ÈÈç˵ʱÇø²»Í¬£©£¬NOW()ÔÚÁ½Ì¨·þÎñÆ÷É쵀 ½á¹û¾Í¿ÉÄܲ»Ò»Ö¡£ÔÚMySQL5.1À½«Ö§³ÖÐи´ÖÆ£¬ÄÇʱºò¾Í²»´æÔÚÕâ¸öÎÊÌâÁË¡£²»¹ý²»¹ÜÔõô˵£¬¶¼²»Ó¦¸ÃÔÚ³ÌÐòÀïʹÓÃNOW()£¬Ê±¼äµÄ¼ÆËãÔÚÓ¦Óà ³ÌÐòÀïÍê³É¡£ÕâÀï½éÉÜÒ»¸ö¶îÍâµÄС¼¼ÇÉ£º»ñµÃʱ¼ä´Á£¬ºÍtime()Ïà±È£¬$_SERVER[‘REQUEST_TIME’] ÉÙ×öÁËÒ»´Îϵͳµ÷Ó㬲»¹ýÊÇ·ñºÏÊÊÒªÊӿ͹ÛÇé¿ö¶ø¶¨¡£
Õâµã²»¸Ò¹¶Í¬£¬binlogÉÏÓÐʱ¼ä´ÁÐÅÏ¢£¬ËùÒÔÓ¦¸Ã¿ÉÒÔ


Ïà¹ØÎĵµ£º

ubuntu mysqlµÄ°²×°

sudo apt-get install mysql-server
Õâ¸öÓ¦¸ÃºÜ¼òµ¥ÁË£¬¶øÇÒÎÒ¾õµÃ´ó¼ÒÔÚ°²×°·½ÃæҲûʲô̫´óÎÊÌ⣬ËùÒÔÒ²¾Í²»¶à˵ÁË£¬ÏÂÃæÎÒÃÇÀ´½²½²ÅäÖá£
ÅäÖÃMySQL
×¢Ò⣬ÔÚUbuntuÏÂMySQLȱʡÊÇÖ»ÔÊÐí±¾µØ·ÃÎʵģ¬Èç¹ûÄãÒªÆäËû»úÆ÷Ò²Äܹ»·ÃÎʵĻ°£¬ÄÇôÐèÒª¸Ä±ä/etc/mysql/my.cnfÅäÖÃÎļþÁË£¡ÏÂÃæÎÒÃÇÒ»²½²½µØÀ´£º
ĬÈϵÄMySQL°²× ......

mysql distinct ¶Ô¶à×ֶιýÂ˲»ÕýÈ·µÄ½â¾ö·½·¨


ÏÂÃæÏÈÀ´¿´¿´Àý×Ó£º
    table
  id name
  1 a
  2 b
  3 c
  4 c
  5 b
¿â½á¹¹´ó¸ÅÕâÑù£¬ÕâÖ»ÊÇÒ»¸ö¼òµ¥µÄÀý×Ó£¬Êµ¼ÊÇé¿ö»á¸´Ôӵöࡣ
±ÈÈçÎÒÏëÓÃÒ»ÌõÓï¾ä²éѯµÃµ½name²»Öظ´µÄËùÓÐÊý¾Ý£¬ÄǾͱØÐëʹÓÃdistinctÈ¥µô¶àÓàµÄÖظ´¼Ç¼ ......

mysqlÁ¬½Ó²âÊÔ³ÌÐò

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%
//Á¬½ÓÊý¾Ý¿â
try
{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Connection connection= java.sql.DriverManager.getConnection("jdbc:mysql://localhost/dangyuan","root", ......

PHPÓëMySQL¿ª·¢ÖеÄ×Ö·û±àÂëÎÊÌâ

Ò»£®¹ØÓÚMySQLÊý¾Ý¿â·þÎñÆ÷
MySQL·þÎñÆ÷µÄĬÈϱàÂëÊÇLatin1£¬²»Ö§³ÖÖÐÎÄ£¬ÄÇôÈçºÎÐÞ¸ÄMySQLµÄĬÈϱàÂëÄØ£¬ÏÂÃæÒÔUTF-8ΪÀýÀ´ËµÃ÷¡£
1¡¢ÖÐÖ¹MySQL·þÎñ£¨bin/mysqladmin -u root shutdown£©
2¡¢ÔÚ/etc/ÏÂÕÒµ½my.cnf£¬Èç¹ûûÓоͰÑMySQLµÄ°²×°Ä¿Â¼ÏµÄsupport-filesĿ¼ÏµÄmy-medium.cnf¸´ÖƵ½/etc/ϲ¢¸ÄÃûΪmy.cnf¼´¿É ......

Mysql ѧϰ ³£ÓÃÃüÁî


1Â¥



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