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

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_ÃüÁî¹éÀà 91KGE

.Á¬½Ómysql    mysql -uroot -padmin -hlocalhost
.Á¬½ÓmysqladminÃüÁîÐпͻ§¶Ë³ÌÐò mysqladmin -uroot -padmin -hlocalhost
.Æô¶¯mysql   mysqld
.¹Ø±Õ  mysqladmin -uroot -padmin -hlocalhost shutdown
.ÐÞ¸ÄÃÜÂë
set password for 'root'@'localhost' = password('admin')
update ......

Linux mysql ·þÎñÆ÷ÂýµÄÔ­Òò

Õ⼸ÌìLinux·þÎñÆ÷ºÜÂý,ºÜ׿±ÕÒ²»µ½½â¾ö°ì·¨!ºó°Ù¶ÈÏà¹Ø×ÖÑÛ,²éÕÒµ½ÊÇMySQLµÄÎÊÌâ,
ÈçÏÂΪ½â¾ö·½°¸
:
Á¬½ÓMySQLËÙ¶ÈÂýµÄ½â¾ö·½·¨.
PHPÔ¶³ÌÁ¬½ÓMYSQLËÙ¶ÈÂý,ÓÐʱԶ³ÌÁ¬½Óµ½MYSQLÓÃʱ4-20Ãë²»µÈ,±¾µØÁ¬½ÓMYSQLÕý³£,³öÏÖÕâÖÖÎÊÌâµÄÖ÷ÒªÔ­ÒòÊÇ,ĬÈÏ°²×°µÄ
MYSQL¿ªÆôÁËDNSµÄ·´Ïò½âÎö,ÔÚMY.CNF(UNIX»òLINUXϵͳÏÂ)»òMY.INI ......

mysqlÖÐÖÐ×Ö·û´®½ØÈ¡º¯Êý

MySQL ×Ö·û´®½ØÈ¡º¯Êý£ºleft(), right(), substring(), substring_index()¡£»¹ÓÐ mid(), substr()¡£ÆäÖУ¬mid(), substr() µÈ¼ÛÓÚ substring() º¯Êý£¬substring() µÄ¹¦Äܷdz£Ç¿´óºÍÁé»î¡£ 1. ×Ö·û´®½ØÈ¡£ºleft(str, length) mysql> select left('sqlstudy.com', 3);+-------------------------+| left('sqlstudy.com', 3) | ......

ÔÚÒ»µçÄÔÉÏ°²×°¶àmysqlʵÀý

ÎҵĻ·¾³£º
Ô­ÓÐÒ»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 ......

wampÈçºÎÐÞ¸ÄmysqlĬÈÏ¿ÕÃÜÂë

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 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ