MysqlÖ¸Á showÓ÷¨
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; // ÏÔʾ±íÖÐÁÐÃû³Æ
d. show grants for [email=[ft=#ffff00,4,]user_name@localhost]user_name@localhost[/email]; // ÏÔʾһ¸öÓû§µÄȨÏÞ£¬ÏÔʾ½á¹ûÀàËÆÓÚgrant ÃüÁî
e. show index from table_name; // ÏÔʾ±íµÄË÷Òý
f. show status; // ÏÔʾһЩϵͳÌض¨×ÊÔ´µÄÐÅÏ¢£¬ÀýÈ磬ÕýÔÚÔËÐеÄÏß³ÌÊýÁ¿
g. show variables; // ÏÔʾϵͳ±äÁ¿µÄÃû³ÆºÍÖµ
h. show processlist; // ÏÔʾϵͳÖÐÕýÔÚÔËÐеÄËùÓнø³Ì£¬Ò²¾ÍÊǵ±Ç°ÕýÔÚÖ´ÐеIJéѯ¡£´ó¶àÊýÓû§¿ÉÒԲ鿴
ËûÃÇ×Ô¼ºµÄ½ø³Ì£¬µ«ÊÇÈç¹ûËûÃÇÓµÓÐprocessȨÏÞ£¬¾Í¿ÉÒԲ鿴ËùÓÐÈ˵Ľø³Ì£¬°üÀ¨ÃÜÂë¡£
i. show table status; // ÏÔʾµ±Ç°Ê¹ÓûòÕßÖ¸¶¨µÄdatabaseÖеÄÿ¸ö±íµÄÐÅÏ¢¡£ÐÅÏ¢°üÀ¨±íÀàÐͺͱíµÄ×îиüÐÂʱ¼ä
j. show privileges; // ÏÔʾ·þÎñÆ÷ËùÖ§³ÖµÄ²»Í¬È¨ÏÞ
k. show create database database_name; // ÏÔʾcreate database Óï¾äÊÇ·ñÄܹ»´´½¨Ö¸¶¨µÄÊý¾Ý¿â
l. show create table table_name; // ÏÔʾcreate database Óï¾äÊÇ·ñÄܹ»´´½¨Ö¸¶¨µÄÊý¾Ý¿â
m. show engies; // ÏÔʾ°²×°ÒÔºó¿ÉÓõĴ洢ÒýÇæºÍĬÈÏÒýÇæ¡£
n. show innodb status; // ÏÔʾinnoDB´æ´¢ÒýÇæµÄ״̬
o. show logs; // ÏÔʾBDB´æ´¢ÒýÇæµÄÈÕÖ¾
p. show warnings; // ÏÔʾ×îºóÒ»¸öÖ´ÐеÄÓï¾äËù²úÉúµÄ´íÎó¡¢¾¯¸æºÍ֪ͨ
q. show errors; // Ö»ÏÔʾ×îºóÒ»¸öÖ´ÐÐÓï¾äËù²úÉúµÄ´íÎó
Ïà¹ØÎĵµ£º
ÔÚ[mysqld] ÏÂÌí¼Ó²ÎÊýÈçÏÂ
#´íÎóÈÕÖ¾Êä³ö·¾¶(ʹÓÃ/×÷Ϊ·Ö¸î¶ø²»ÊÇ\)
log-error="your error-log path"
log="Your mysql log path"
log-show-queries="Your slowquery path"
#É趨³¬Ê±Ê±¼ä ´Ë´¦ÉèÖÃΪÁ½Ãë
long_query_time=2
Ok save my.ini
next
#Í£Ö¹mysql ·þÎñ
net s ......
1 Apache
ÐÞ¸Ä documentroot ¸ùĿ¼
directory ·ÃÎʸùĿ¼ȨÏÞ
directoryindex ĬÈÏÊ×Ò³ ......
ÔÚÊý¾Ý¿â
ÖУ¬UNION
ºÍUNION
ALL
¹Ø¼ü×Ö¶¼Êǽ«Á½¸ö½á¹û¼¯ºÏ²¢ÎªÒ»¸ö£¬µ«ÕâÁ½Õß´ÓʹÓúÍЧ
ÂÊÉÏÀ´Ëµ¶¼ÓÐËù²»Í¬¡£
MySQL
ÖÐ
µÄUNION
UNIONÔÚ½øÐбíÁ´½Óºó»áɸѡµôÖظ´µÄ¼Ç¼£¬ËùÒÔÔÚ±íÁ´½Óºó»á¶ÔËù²úÉúµÄ½á¹û¼¯½øÐÐÅÅÐòÔËË㣬ɾ³ýÖظ´µÄ¼Ç¼ÔÙ
·µ»Ø½á¹û¡£Êµ¼Ê´ó²¿·ÖÓ¦ÓÃÖÐÊDz»»á²úÉúÖظ´µÄ¼Ç¼£¬×î³£¼ûµÄÊǹý³Ì± ......
MySQL²éѯ±íÄÚÖظ´¼Ç¼
²éѯ¼°É¾³ýÖظ´¼Ç¼µÄ·½·¨
(Ò»)
1¡¢²éÕÒ±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´ÅжÏ
select * from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
2¡¢É¾³ý±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΠ......