mysqlÏà¹Ø
ÏÔʾ¡¢ÉèÖÃ×Ô¶¯Ìá½» show variable like 'autocommit' set autocommit=1 or 0
ÉèÖÃÈÕÖ¾£º
ÔÚ/etc/mysql/my.cnfÖÐÉèÖÃÈçÏ¿ÉÔÙslow.logÖÐÊä³öÔËÐÐʱ¼ä³¬¹ýÒ»ÃëµÄsqlÓï¾ä
[mysqld]
log-slow-queries = /tmp/slow.log
long_query_time = 1
ÉèÖÃÈÕÖ¾Êä³öÔËÐг¬¹ý1ÃëµÄsqlÓï¾ä set global long_query_time = 1;
ÉèÖÃÈÕÖ¾Êä³ö·½Ê½ÎªÎļþ set global log_output=file;
ÉèÖÃgeneralÎļþ´æ·Å·¾¶ set global general_log_file='/tmp/general.log';
ÉèÖÃslowÎļþ´æ·Å·¾¶ set global slow_query_log_file='/tmp/slow.log';
ÆôÓÃgeneralºÍslow set global general_log=on;
set global slow_query_log=on;
°ÑûÓÐʹÓÃË÷ÒýµÄ²éѯ¼Ç¼µ½ÂýËÙ²éѯÈÕÖ¾ÖÐ SET GLOBAL log_queries_not_using_indexes = 1
¼ì²éÊÇ·ñÆôÓÃÁËÈÕÖ¾ show variables like 'log_bin';
ÏÔʾµ±Ç°ÈÕÖ¾ÎļþÃû show master status;
²éѯ long_query_time µÄÖµ show variables like 'long%';
·ÖÎöslow.logÎļþ¹¤¾ß
mysqldumpslow -s c -t 20 host-slow.log
mysqldumpslow -s r -t 20 host-slow.log
ÉÏÊöÃüÁî¿ÉÒÔ¿´³ö·ÃÎÊ´ÎÊý×î¶àµÄ20¸ösqlÓï¾äºÍ·µ»Ø¼Ç¼¼¯×î¶àµÄ20¸ösql¡£
mysqldumpslow -t 10 -s t -g “left join” host-slow.log
Õâ¸öÊÇ°´ÕÕʱ¼ä·µ»ØÇ°10ÌõÀïÃ溬ÓÐ×óÁ¬½ÓµÄsqlÓï¾ä¡£
show status like 'last_query_cost'; ÉÏÒ»´Î²éѯÔì³É¶àÉÙ´ÎËæ¼´¶ÁÈ¡
ÖÜÆÚÐÔÔËÐÐshow status²¢ºÍÇ°Ò»´Î×÷±È½Ï mysqladmin extended -r -i 10
Ö÷´Ó·þÎñÆ÷ͬ²½
show slave status\G;
start slave;
stop slave;
¼ì²é·þÎñÆ÷¶Ë¿ÚʹÓÃÇé¿ö -i: ¶Ë¿ÚºÅ£¬-p ½ø³ÌºÅ
lsof -i:8009 | wc -l
mysql»º´æ
have_query_cache ÊÇ·ñÖ§³Ö²éѯ»º´æÇø “YES”±íÊÇÖ§³Ö²éѯ»º´æÇø
query_cache_limit ¿É»º´æµÄSelect²éѯ½á¹ûµÄ×î´óÖµ 1048576 byte /1024 = 1024kB ¼´×î´ó¿É»º´æµÄselect²éѯ½á¹û±ØÐëСÓÚ1024KB
query_cache_min_res_unit ÿ´Î¸øquery cache½á¹û·ÖÅäÄÚ´æµÄ´óС ĬÈÏÊÇ 4096 byte Ò²¼´ 4kB query_cache_min_res_unit = (query_cache_size - Qcache_free_memory) / Qcache_queries_in_cache
Qcache_free_memory ±íʾ²éѯ»º´æÇøÏÖÔÚ»¹ÓжàÉٵĿÉÓÃÄÚ´æ
Qcache_hits ±íʾ²éѯ»º´æÇøµÄÃüÖиöÊý£¬Ò²¾ÍÊÇÖ±½Ó´Ó²éѯ»º´æÇø×÷³öÏìÓ¦´¦ÀíµÄ²éѯ¸öÊý
Qcache_inserts ±íʾ²éѯ»º´æÇø´
Ïà¹ØÎĵµ£º
Ò»¡¢Á¬½ÓMYSQL¡£
¸ñʽ£º mysql -hÖ÷»úµØÖ· -uÓû§Ãû £pÓû§ÃÜÂë
1¡¢Á¬½Óµ½±¾»úÉϵÄMYSQL¡£
Ê×ÏÈ´ò¿ªDOS´°¿Ú£¬È»ºó½øÈëĿ¼mysql\bin£¬ÔÙ¼üÈëÃüÁîmysql -u root -p£¬»Ø³µºóÌáʾÄãÊäÃÜÂë.×¢ÒâÓû§ÃûÇ°¿ÉÒÔÓпոñÒ²¿ÉÒÔûÓпոñ£¬µ«ÊÇÃÜÂëÇ°±ØÐëûÓпոñ£¬·ñÔòÈÃÄãÖØÐÂÊäÈëÃÜÂë.
Èç¹û¸Õ°²×°ºÃMYSQL£¬³¬¼¶Óû§rootÊÇûÓÐÃÜ ......
ÏÈÓÃrootµÇ½mysql -u root -p
mysql>show databases;
mysql>use mysql;
update user set password=password('ÄãÏëÉèÖõÄÃÜÂë')
where user='root'; ......
¸öÈËÀͶ¯£¬»¹Çë×ðÖØ£¬ÈçÈôתÔØÇë×¢Ã÷³ö´¦¡£iihero@CSDN
¿´µ½ÓÐЩÅóÓÑÀÏÎÊÕâ¸ö·Ç°²×°°æÓë°²×°°æÓÐʲôÇø±ð£¨µ±È»ÊÇwindowsƽ̨)
¸É´àдÁËÒ»¸ö½Å±¾×Ô¶¯ÎªÆä´´½¨mysql5·þÎñ¡£
½Å±¾ÈçÏ£¬½«Æä·Åµ½½âѹÒÔºóµÄĿ¼Àï±ßÖ´Ðм´¿É¡£
@echo off
echo "This is a demo script for auto installation of noninstall version o ......
ÎҵĻ·¾³£º
ÔÓÐÒ»mysql5.0ʵÀý£¬ÏÖа²×°Ò»mysql5.1£¬²¢½«ÐµÄ5.1ʵÀýµÄÊý¾Ý·¾¶·ÅÔÚÁíһĿ¼¡£
mysql5.1µÄmy.iniÈçÏÂ
£¨ÅäÖÃmy.iniµÄ²Î¿¼×ÊÁÏ£º
http://dev.mysql.com/doc/refman/5.1/en/option-files.html
http://downloads.mysql.com/docs/mysql-windows-excerpt-5.1-en.pdf
http://dev.mysql.com/doc/refman/5.0 ......
cmdÏÂÇл»µ½ mysql °²×°Ä¿Â¼
Àý
d:/mysql/bin (Èç¹ûÓÃWAMP°²×°ÔòÊÇD:\wamp\bin\mysql\mysql5.1.30\bin)
Ç°Ì᣺mysqlÓû§rootÃÜÂëΪ¿Õ.
ÊäÈë mysql -u root mysql
mysql> ״̬ÏÂÊäÈë update user set password=password('ÐÂÃÜÂë') where user='root';
»ØÏÔ
Query OK, 0 rows ......