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

MySQL ShowÃüÁîµÄʹÓÃ

show tables»òshow tables from database_name;
½âÊÍ£ºÏÔʾµ±Ç°Êý¾Ý¿âÖÐËùÓбíµÄÃû³Æ
show databases;
½âÊÍ£ºÏÔʾmysqlÖÐËùÓÐÊý¾Ý¿âµÄÃû³Æ
show processlist;
½âÊÍ£ºÏÔʾϵͳÖÐÕýÔÚÔËÐеÄËùÓнø³Ì£¬Ò²¾ÍÊǵ±Ç°ÕýÔÚÖ´ÐеIJéѯ¡£´ó¶àÊýÓû§¿ÉÒԲ鿴
ËûÃÇ×Ô¼ºµÄ½ø³Ì£¬µ«ÊÇÈç¹ûËûÃÇÓµÓÐprocessȨÏÞ£¬¾Í¿ÉÒԲ鿴ËùÓÐÈ˵Ľø³Ì£¬°üÀ¨ÃÜÂë¡£
show table status;
½âÊÍ£ºÏÔʾµ±Ç°Ê¹ÓûòÕßÖ¸¶¨µÄdatabaseÖеÄÿ¸ö±íµÄÐÅÏ¢¡£ÐÅÏ¢°üÀ¨±íÀàÐͺͱíµÄ×îиüÐÂʱ¼ä
show columns from table_name from database_name; »òshow columns from
database_name.table_name;
½âÊÍ£ºÏÔʾ±íÖÐÁÐÃû³Æ
show grants for user_name@localhost;
½âÊÍ£ºÏÔʾһ¸öÓû§µÄȨÏÞ£¬ÏÔʾ½á¹ûÀàËÆÓÚgrant ÃüÁî
show index from table_name;
½âÊÍ£ºÏÔʾ±íµÄË÷Òý
show status;
½âÊÍ£ºÏÔʾһЩϵͳÌض¨×ÊÔ´µÄÐÅÏ¢£¬ÀýÈ磬ÕýÔÚÔËÐеÄÏß³ÌÊýÁ¿
show variables;
½âÊÍ£ºÏÔʾϵͳ±äÁ¿µÄÃû³ÆºÍÖµ
show privileges;
½âÊÍ£ºÏÔʾ·þÎñÆ÷ËùÖ§³ÖµÄ²»Í¬È¨ÏÞ
show create database database_name;
½âÊÍ£ºÏÔʾcreate database Óï¾äÊÇ·ñÄܹ»´´½¨Ö¸¶¨µÄÊý¾Ý¿â
show create table table_name;
½âÊÍ£ºÏÔʾcreate database Óï¾äÊÇ·ñÄܹ»´´½¨Ö¸¶¨µÄÊý¾Ý¿â
show engies;
½âÊÍ£ºÏÔʾ°²×°ÒÔºó¿ÉÓõĴ洢ÒýÇæºÍĬÈÏÒýÇæ¡£
show innodb status;
½âÊÍ£ºÏÔʾinnoDB´æ´¢ÒýÇæµÄ״̬
show logs;
½âÊÍ£ºÏÔʾBDB´æ´¢ÒýÇæµÄÈÕÖ¾
show warnings;
½âÊÍ£ºÏÔʾ×îºóÒ»¸öÖ´ÐеÄÓï¾äËù²úÉúµÄ´íÎó¡¢¾¯¸æºÍ֪ͨ
show errors;
½âÊÍ£ºÖ»ÏÔʾ×îºóÒ»¸öÖ´ÐÐÓï¾äËù²úÉúµÄ´íÎó


Ïà¹ØÎĵµ£º

mysql³£ÓÃÖ¸ÁºÏ


Java´úÂë
mysql> select version(),current_date;   
²éѯmysqlµÄ°æ±¾ºÅ ºÍ  ÈÕÆÚ   
mysql> select version();   
²éѯmysqlµÄ°æ±¾ºÅ   
select now();   
²éѯµ±Ç°ÈÕÆÚºÍ׼ȷµÄʱ¼ä  
Java ......

mysql ×ÔÔöÁÐÏà¹ØÎÊÌâÕûÀí

MYSQL×ÔÔöÁÐ
1.¹Ø¼ü×Ö £ºauto_increment
2.×ÔÔöÓ÷¨
Àý:
CREATE TABLE animals ( id mediumint not null auto_increment,
name char(30) not null,
primary key (id));
3.¹ØÓÚ×ÔÔö
Q:Ôõô»ñµÃµ±Ç°µÄ×ÔÔöµÄ×î´óÖµ?
A:select @@identity
Q:Ôõô»ñµÃtableµÄµ±Ç°×ÔÔö×î´óÖµ?
A:select max(id) from table ......

mysql unionÓï·¨

Ò» UNIONÓï·¨
´úÂë ¸´ÖÆ´úÂë
SELECT ...   
UNION [ALL | DISTINCT]   
SELECT ...   
[UNION [ALL | DISTINCT]   
SELECT ...]  
SELECT ... UNION [ALL | DISTINCT] SELECT ... [UNION [ALL | DISTINCT] SELECT ...]
UNIONÓÃÓÚ°Ñ ......

show innodb status (mysql)


µ±Ç°»îÔ¾µÄÊÂÎñ:
------------
TRANSACTIONS
------------
Trx id counter080157601
Purge done for trx's n:o <0 80154573 undo n:o <0 0
History list length 6
Total number of lock structs in row lock hash table 0
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0 0, not started, proce ......

MySQLÓëÊÂÎñ


×÷ÕߣºÀÏÍõ
MySQL5.X¶¼ÒѾ­·¢²¼ºÃ¾ÃÁË£¬µ«ÊÇ»¹ÓкܶàÈËÈÏΪMySQLÊDz»Ö§³ÖÊÂÎñ´¦ÀíµÄ£¬Õâ²»µÃ²»¹ÖËûÃÇÊǹª¹ÑÎŵģ¬Æäʵ£¬Ö»ÒªÄãµÄMySQL°æ±¾Ö§³ÖBDB»òInnoDB±íÀàÐÍ£¬ÄÇôÄãµÄMySQL¾Í¾ßÓÐÊÂÎñ´¦ÀíµÄÄÜÁ¦¡£ÕâÀïÃ棬ÓÖÒÔInnoDB±íÀàÐÍÓõÄ×î¶à£¬ËäÈ»ºóÀ´·¢ÉúÁËÖîÈçOracleÊÕ¹ºInnoDBµÈÁîMySQL²»Ë¬µÄÊÂÇ飬µ«ÄÇЩÉÌÒµÉϵĶ·ÕùÓ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ