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

mysql»º´æ²ÎÊý

¶ÔmysqlµÄÓÅ»¯²»ÔÚÐУ¬¸ã¹ý¼¸´ÎÓÅ»¯£¬µ«ÊǶ¼²»ÊǺÜÀíÏ룬»¹ÊÇÀË·Ñ×ÊÔ´Ì«¶à¡£Ò»Ö±·¢ÏÖÎÒµÄmysqlµÄ»º´æÃüÖÐÂʼ«²î£¬Çé¿öÁ¼ºÃµÄʱºòµ½´ï¹ý60-70%£¬µ«ÊÇÔËÐÐʱ¼äÒ»³¤£¬Ö»ÓÐ10-20%¡£²éÁËһЩ×ÊÁÏ£¬¹ØÓÚ»º´æµÄһЩ²ÎÊý¼Ç¼
mysql> SHOW VARIABLES LIKE ‘%query_cache%’;
+——————————+———-+
| Variable_name                | Value    |
+——————————+———-+
| have_query_cache             | YES      |
| query_cache_limit            | 1048576  |
| query_cache_min_res_unit     | 4096     |
| query_cache_size             | 67108864 |
| query_cache_type             | ON       |
| query_cache_wlock_invalidate | OFF      |
+——————————+———-+
6 rows in set (0.00 sec)
have_query_cache
ÊÇ·ñÖ§³Ö²éѯ»º´æÇø “YES”±íÊÇÖ§³Ö²éѯ»º´æÇø
query_cache_limit
¿É»º´æµÄSelect²éѯ½á¹ûµÄ×î´óÖµ 1048576 byte /1024 = 1024kB ¼´×î´ó¿É»º´æµÄselect²éѯ½á¹û±ØÐëСÓÚ1024KB
query_cache_min_res_unit
ÿ´Î¸øquery cache½á¹û·ÖÅäÄÚ´æµÄ´óС ĬÈÏÊÇ 4096 byte Ò²¼´ 4kB
¾­¹ýÎÒ²âÊÔ£¬
set GLOBAL query_cache_min_res_unit=4096; µÄʱºò£¬ËéƬ»á±È½Ï¶à£¬ÔÚ3000¶à¡£
set GLOBAL query_cache_min_res_unit=2046;µÄʱºò£¬ËéƬ±È½ÏÉÙ£¬ÔÚ1000¶à¡£
µ«ÊǹýС»áÔö¼ÓIO¸ºµ£
mysql>show status;
ÖмäÓÐÒ»¶Î Qcache_¿ªÍ·µÄ
Qcache_free_blocks                | 4984   &


Ïà¹ØÎĵµ£º

¡¾×ª¡¿³£ÓÃmysql²Ù×÷ÃüÁî

   
Administration ¹ÜÀí
Kill a Thread  ½áÊøÒ»¸öÏß³Ì
mysql > KILL 999;
 
Optimize Table ÓÅ»¯±í
mysql > OPTIMEZE TABLE foo;
 
Reload Users Permissions Ë¢ÐÂMySQLϵͳȨÏÞÏà¹Ø±í  
mysql > FLUSH PRIVILEGES;
 
Repair Table ÐÞ¸´±í
mysql > ......

MySqlµÄ±íÀàÐÍ

create database sample;
create table 't_user' (
    'id' int(11) not null auto_increment,
    'name' varchar(100) not null default '',
    primary key ('id')
) type=myisam;
Ñ¡ÏîÖ»ÔÚMySQL 3.23ºÍÒÔºó°æ±¾Öб»ÊµÏÖ¡£
²»Í¬µÄ±íÀàÐÍÊÇ£º
ISAM Ô­À´µÄ±í´¦ÀíÆ ......

linux mysqlÍü¼ÇÃÜÂëµÄ¶àÖÖ½â¾ö·½·¨¡£


ÎÒµÄϵͳÊÇubuntu6.06£¬×î½üÐÂ×°ºÃµÄmysqlÔÚ½øÈëmysql¹¤¾ßʱ£¬×ÜÊÇÓдíÎóÌáʾ:
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ʹÓÃÍøÉϽéÉܵķ½·¨ÐÞ¸ÄrootÓû§µÄÃÜÂ룺
# mysqladmin -uroot -p password 'newpassword'
Enter pass ......

MySQLСÊýλȡÕû

//µÃ·Ö¼ÆËãËÄÉáÎåÈë
SELECT ROUND((SUM(getfeng)/SUM(totalfeng))*100) as feng from answerdata WHERE uid='151' AND targetid IS NOT NULL
1.ceil £¨£© /ceiling£¨£© ÏòÉÏÈ¡Õû
   Àý£º ceil£¨1.2£© = 2
2.floor £¨£© ÏòÏÂÈ¡Õû
    Àý£º floor£¨1.2£© = 1
3.round£¨£© ËÄÉáÎåÈë
 &n ......

mysqlÖвåÈëÒ»Ìõ¼Ç¼·µ»Ø¸Ã¼Ç¼id

1.select max(id) from user;
2.select last_insert_id() as id from user limit 1; 
(Õâ¸ö²âÊԵķµ»ØidÒ»Ö±ÊÇ0£¬ÓеãÎÊÌâ)
3.´¢´æ¹ý³Ì
1£©
oracelÖÐ
create sequence seqID
minvalue 1
maxvalue 999999999999999999999999999
start with 1
increment by 1
nocache
order;
create or replace procedure ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ