mysql show status
²é¿´·þÎñÆ÷Ŀǰ״̬ÐÅÏ¢µÄÃüÁÁ½ÖÖ·½Ê½£º
1. ÃüÁîÐУ¬½øÈëmysql/binĿ¼Ï£¬ÊäÈëmysqladmin extended-status
2. Á¬½Óµ½mysql£¬ÊäÈëshow status;
3. Èç¹ûÒª²é¿´Ä³¸öÊý¾Ý£¬¿ÉÒÔ
mysql> show status like 'table%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| Table_locks_immediate | 12 |
| Table_locks_waited | 0 |
+-----------------------+-------+
ÐèÒª¹Ø×¢µÄ²¿·ÖÓУº
qcache% ,open%tables,threads%,%key_read%,created_tmp%,sort%,com_select
Õ⼸¸ö±äÁ¿µÄµ÷ÓŲο¼“mysql·þÎñÆ÷µ÷ÓÅ”http://www.ibm.com/developerworks/cn/linux/l-tune-lamp-3.html
״̬±äÁ¿Ïê½â£¬¿ÉÄÜ»¹Óв¿·ÖеıäÁ¿Ã»ÁгöÀ´£¬
È«²¿×´Ì¬½âÊͲο´mysqlÊÖ²áhttp://dev.mysql.com/doc/refman/5.0/en/server-status-variables.html£¨ºìÉ«²¿·ÖÊǵ÷ÓŵÄʱºòÖصã¹Ø×¢µÄ±äÁ¿£©
Aborted_clients
Ö¸³öÓÉÓÚijÖÖÔÒò¿Í»§³ÌÐò²»ÄÜÕý³£¹Ø±ÕÁ¬½Ó¶øµ¼ÖÂʧ°ÜµÄÁ¬½ÓµÄÊýÁ¿¡£Èç¹û¿Í»§²»ÔÚÍ˳ö֮ǰµ÷Õûmysql_close()º¯Êý£¬wait_timeout»òinteractive_timeoutµÄÏÞÖÆÒѾ±»³¬³ö£¬»òÕßÊÇ¿Í»§¶Ë³ÌÐòÔÚ´«ÊäµÄ¹ý³ÌÖб»¹Ø±Õ£¬ÔòÕâÖÖÇé¿ö»á·¢Éú¡£
Aborted_connects
Ö¸³öÊÔͼÁ¬½Óµ½MYSQLµÄʧ°ÜµÄ´ÎÊý¡£ÕâÖÖÇé¿öÔÚ¿Í»§³¢ÊÔÓôíÎóµÄÃÜÂë½øÐÐÁ¬½Óʱ£¬Ã»ÓÐȨÏÞ½øÐÐÁ¬½Óʱ£¬Îª»ñµÃÁ¬½ÓµÄÊý¾Ý°üËù»¨·ÑµÄʱ¼ä³¬¹ýÁËconnect_timeoutÏÞÖƵÄÃëÊý£¬»òÊý¾Ý°üÖÐûÓаüº¬ÕýÈ·µÄÐÅϢʱ£¬¶¼»á·¢Éú¡£
Bytes_received
´Ó¿Í»§´¦ÒѾ½ÓÊÕµ½µÄ×Ö½ÚÊý¡£
Bytes_sent
ÒѾ·¢Ë͸øËùÓпͻ§µÄ×Ö½ÚÊý¡£
Com_[statement]
ÓÃÓÚÿһÖÖÓï¾äµÄÕâЩ±äÁ¿ÖеÄÒ»ÖÖ¡£±äÁ¿Öµ±íʾÕâÌõÓï¾ä±»Ö´ÐеĴÎÊý£¬Èçcom_select,±íʾ²éѯÓï¾ä±»Ö´ÐеĴÎÊý¡£
Connections
ÊÔͼÁ¬½Óµ½MYSQL·þÎñÆ÷µÄ´ÎÊý¡£
Created_tmp_disk_tables
Ö´ÐÐÓï¾äʱ£¬´ÅÅÌÉÏÉú³ÉµÄÒþº¬ÁÙʱ±íµÄÊýÁ¿
Created_tmp_tables
Ö´ÐÐÓï¾äʱ£¬ÄÚ´æÖÐÉú³ÉµÄÒþº¬ÁÙʱ±íµÄÊýÁ¿
Created_tmp_files
ÓÉmysqldÉú³ÉµÄÁÙʱÎļþµÄÊýÁ¿
Delayed_insert_threads
µ±Ç°ÕýÔÚʹÓõÄÑÓ³Ù²åÈë¾ä±úµÄÏß³ÌÊýÁ¿
Delayed_writes
ÓÉINSERT
Ïà¹ØÎĵµ£º
javaÖÐʱ¼ä´ÁºÍʱ¼ä×Ö·û´®Ö®¼äµÄת»»
»ñÈ¡µ±Ç°µÄunixʱ¼ä´Á
new Date().getTime()
System.currentTimeMillis()
·µ»ØµÄÊǺÁÃëÊý£¬Òª×ª»»long t = System.currentTimeMillis()/1000;
»ñÈ¡µ±Ç°ÄêÔÂÈÕÒÔ¼°Ê±·ÖÃë
Calendar c = Calendar.getInstance();
c.get(Calendar.YEAR)) c.get(Calendar.YEAR)) c.get(C ......
mysqlÖ´ÐÐsqlÓï¾äʱÓÐʱ»á³öÏÖCR_COMMANDS_OUT_OF_SYNC´íÎó£¨2014£©
ÌáʾÓïΪ
commands out of sync; you can't run this command now
ÍøÉ϶Դ˴íÎóµÄÃèÊöºÜÉÙ£¬¶øÇÒûÓиø³ö½â¾ö·½·¨¡£
ÆäʵÕâÊÇÒòΪÉÏÒ»¸ösqlÖ´Ðзµ»ØÁ˶à¸ö½á¹û¼¯£¬µ«Ã»Óаѽá¹û¶¼È¡³öÀ´£¬¾ÍÖ´ÐÐÁËеÄsqlÓï¾ä£¬¾Í»á²úÉúÕâ¸ö´íÎó¡£
Ó¦ÔÚsqlÓï¾äÖ´Ðкó ......
Æô¶¯£ºnet start mySql;
¡¡¡¡½øÈ룺mysql -u root -p/mysql -h localhost -u root -p databaseName;
¡¡¡¡ÁгöÊý¾Ý¿â£ºshow databases;
¡¡¡¡Ñ¡ÔñÊý¾Ý¿â£ºuse databaseName;
¡¡¡¡Áгö±í¸ñ£ºshow tables£»
¡¡¡¡ÏÔʾ±í¸ñÁеÄÊôÐÔ£ºshow columns from tableName£»
¡¡¡¡½¨Á¢Êý¾Ý¿â£ºsource fileName.txt;
¡¡¡¡Æ¥Åä× ......
±¾ÎÄÌÖÂÛ MySQL µÄ±¸·ÝºÍ»Ö¸´»úÖÆ£¬ÒÔ¼°ÈçºÎά»¤Êý¾Ý±í£¬°üÀ¨×îÖ÷ÒªµÄÁ½ÖÖ±íÀàÐÍ£ºMyISAM ºÍ Innodb£¬ÎÄÖÐÉè¼ÆµÄ MySQL °æ±¾Îª 5.0.22¡£
Ä¿Ç° MySQL Ö§³ÖµÄÃâ·Ñ±¸·Ý¹¤¾ßÓУºmysqldump¡¢mysqlhotcopy£¬»¹¿ÉÒÔÓà SQL Óï·¨½øÐб¸·Ý£ºBACKUP TABLE »òÕß SELECT INTO OUTFILE£¬ÓÖ»òÕß±¸·Ý¶þ½øÖÆÈÕÖ¾£¨binlog£©£¬»¹¿ÉÒÔÊÇ ......
ÍøÉϵĽâ¾ö·½·¨´ó¶àÊÇÒªÐÞ¸ÄmysqlÅäÖÃÎļþ£¬¶ÔÎÒÃDz»Êʺϡ£jhostÖ÷Ò³ÉÏ¿´µ½ÆªÎÄÕ£¬µ«ÀïÃæ˵µÄÇý¶¯Ôç¾ÍÊÇÀÏÇý¶¯ÁË£¬»³ÒÉËûÊÇ´ÓÍøÉϸ´ÖƹýÀ´µÄÀÏ°æ±¾£¬²»ÖªÊÇ·ñÄÜÓá£ÏÖÔÚ°ÑÎÒ×Ô¼ºµÄ½â¾ö·½°¸Ìù³öÀ´£¬¹©´ó¼Ò²Î¿¼£¬»¶ÓÅúÆÀÖ¸Õý¡£
´ó¼Ò×¢ÒâºìÉ«²¿·Ö£¬·Ï»°²»¶à˵£º
µÚÒ»²½£ºÍøҳͷÉèÖãº
<%@ page contentType="text/html ......