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

¸ù¾ÝstatusÐÅÏ¢¶ÔMySQL·þÎñÆ÷½øÐÐÓÅ»¯

¡¡ÍøÉÏÓкܶàµÄÎÄÕ½ÌÔõôÅäÖÃMySQL·þÎñÆ÷£¬µ«¿¼Âǵ½·þÎñÆ÷Ó²¼þÅäÖõIJ»Í¬£¬¾ßÌåÓ¦ÓõIJî±ð£¬ÄÇЩÎÄÕµÄ×ö·¨Ö»ÄÜ×÷Ϊ³õ²½ÉèÖòο¼£¬ÎÒÃÇÐèÒª¸ù¾Ý×Ô¼ºµÄÇé¿ö½øÐÐÅäÖÃÓÅ»¯£¬ºÃµÄ×ö·¨ÊÇMySQL·þÎñÆ÷Îȶ¨ÔËÐÐÁËÒ»¶Îʱ¼äºóÔËÐУ¬¸ù¾Ý·þÎñÆ÷µÄ”״̬”½øÐÐÓÅ»¯¡£
mysql> show global status;
¡¡¡¡¿ÉÒÔÁгöMySQL·þÎñÆ÷ÔËÐи÷ÖÖ״ֵ̬£¬ÁíÍ⣬²éѯMySQL·þÎñÆ÷ÅäÖÃÐÅÏ¢Óï¾ä£º
mysql> show variables;
¡¡¡¡Ò»¡¢Âý²éѯ
mysql> show variables like '%slow%';
+------------------+-------+
| Variable_name¡¡¡¡¡¡¡¡ | Value |
+------------------+-------+
| log_slow_queries | ON¡¡¡¡¡¡¡¡ |
| slow_launch_time | 2¡¡¡¡¡¡¡¡¡¡ |
+------------------+-------+
mysql> show global status like '%slow%';
+---------------------+-------+
| Variable_name¡¡¡¡¡¡¡¡¡¡¡¡¡¡ | Value |
+---------------------+-------+
| Slow_launch_threads | 0¡¡¡¡¡¡¡¡¡¡ |
| Slow_queries¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ | 4148 |
+---------------------+-------+
¡¡¡¡ÅäÖÃÖдò¿ªÁ˼ǼÂý²éѯ£¬Ö´ÐÐʱ¼ä³¬¹ý2ÃëµÄ¼´ÎªÂý²éѯ£¬ÏµÍ³ÏÔʾÓÐ4148¸öÂý²éѯ£¬Äã¿ÉÒÔ·ÖÎöÂý²éѯÈÕÖ¾£¬ÕÒ³öÓÐÎÊÌâµÄSQLÓï¾ä£¬Âý²éѯʱ¼ä²»ÒËÉèÖùý³¤£¬·ñÔòÒâÒå²»´ó£¬×îºÃÔÚ5ÃëÒÔÄÚ£¬Èç¹ûÄãÐèҪ΢Ã뼶±ðµÄÂý²éѯ£¬¿ÉÒÔ¿¼ÂǸøMySQL´ò²¹¶¡£ºhttp://www.percona.com/docs/wiki/release:start£¬¼ÇµÃÕÒ¶ÔÓ¦µÄ°æ±¾¡£
¡¡´ò¿ªÂý²éѯÈÕÖ¾¿ÉÄÜ»á¶ÔϵͳÐÔÄÜÓÐÒ»µãµãÓ°Ï죬Èç¹ûÄãµÄMySQLÊÇÖ÷£­´Ó½á¹¹£¬¿ÉÒÔ¿¼ÂÇ´ò¿ªÆäÖÐһ̨´Ó·þÎñÆ÷µÄÂý²éѯÈÕÖ¾£¬ÕâÑù¼È¿ÉÒÔ¼à¿ØÂý²éѯ£¬¶ÔϵͳÐÔÄÜÓ°ÏìÓÖС¡£
¡¡¡¡¶þ¡¢Á¬½ÓÊý
¡¡¡¡¾­³£»áÓö¼û”MySQL: ERROR 1040: Too many connections”µÄÇé¿ö£¬Ò»ÖÖÊÇ·ÃÎÊÁ¿È·ÊµºÜ¸ß£¬MySQL·þÎñÆ÷¿¹²»×¡£¬Õâ¸öʱºò¾ÍÒª¿¼ÂÇÔö¼Ó´Ó·þÎñÆ÷·ÖÉ¢¶ÁѹÁ¦£¬ÁíÍâÒ»ÖÖÇé¿öÊÇMySQLÅäÖÃÎļþÖÐmax_connectionsÖµ¹ýС£º
mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name¡¡¡¡¡¡ | Value |
+-----------------+-------+
| max_connections | 256¡¡¡¡ |
+-----------------+-------+
¡¡¡¡Õą̂MySQL·þÎñÆ÷×î´óÁ¬½ÓÊýÊÇ256£¬È»ºó²éѯһÏ·þÎñÆ÷ÏìÓ¦µÄ×î´óÁ¬½ÓÊý£º
mysql> show global status like 'Max_used_connections';
¡¡¡¡MySQL·þÎñÆ÷¹ýÈ¥µÄ×î´óÁ¬½ÓÊýÊÇ245£¬Ã»Óдﵽ·þÎñÆ÷Á¬½ÓÊýÉÏÏÞ256£¬Ó¦¸ÃûÓгöÏÖ10


Ïà¹ØÎĵµ£º

java£¬php£¬mysqlʱ¼ä´¦Àí

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µ¼³öµ¼ÈëÃüÁîµÄÓÃÀý

¡¡1.µ¼³öÕû¸öÊý¾Ý¿â
¡¡¡¡mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû > µ¼³öµÄÎļþÃû
¡¡¡¡mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
¡¡¡¡2.µ¼³öÒ»¸ö±í
¡¡¡¡mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû ±íÃû> µ¼³öµÄÎļþÃû
¡¡¡¡mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql
¡¡¡¡3.µ¼³öÒ»¸öÊý¾Ý¿â½á¹¹
¡ ......

JDBCÁ¬½ÓÖ´ÐÐMySQL´æ´¢¹ý³Ì±¨¿ÕÖ¸Õë»òȨÏÞ´íÎó

 ×î½üʹÓÃrootÓû§±àдÁ˼¸¸ö´æ´¢¹ý³Ì£¬µ«ÊÇʹÓÃÆÕͨÓû§Í¨¹ýJDBCÁ¬½ÓÖ´ÐÐÈ´±¨´í£º
java.lang.NullPointerException......
»ò
java.sql.SQLException: User does not have access to metadata required to determine stored procedure parameter types. If rights can not be granted, configure connection with " ......

MySQL 5.0.16 ÂÒÂëÎÊÌâ´¦Àí°ì·¨


1 ÉèÖÃphpMyAdmin
Language:Chinese simplified (zh-utf-8)
MySQL ×Ö·û¼¯£ºUTF-8 Unicode (utf8)
MySQL Á¬½ÓУ¶Ô gbk_chinese_ci
2 ´´½¨Êý¾Ý¿âʱ
ÕûÀíÉèÖÃ³É gbk_chinese_ci
3 ÓÃSQL½¨Á¢±íÖÐ
ENGINE=MyISAM DEFAULT CHARSET=gbk;
ENGINE=InnoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=40 ;
4 ¼ì²é±í½á¹¹ÖÐ
varcha ......

mysql show status


²é¿´·þÎñÆ÷Ŀǰ״̬ÐÅÏ¢µÄÃüÁÁ½ÖÖ·½Ê½£º
 
1.      ÃüÁîÐУ¬½øÈëmysql/binĿ¼Ï£¬ÊäÈëmysqladmin extended-status
2.      Á¬½Óµ½mysql£¬ÊäÈëshow status;
3.      Èç¹ûÒª²é¿´Ä³¸öÊý¾Ý£¬¿ÉÒÔ
mysql> show s ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ