¡¾×ª¡¿MySQLÓÅ»¯²½Öè¼°my.cnf»º´æÓÅ»¯
1¡¢¿´»úÆ÷ÅäÖã¬Ö¸Èý´ó¼þ£ºcpu¡¢ÄÚ´æ¡¢Ó²ÅÌ
2¡¢¿´mysqlÅäÖòÎÊý
3¡¢²éϵmysqlÐÐ״̬£¬¿ÉÒÔÓÃmysqlreport¹¤¾ßÀ´²é¿´
4¡¢²é¿´mysqlµÄÂý²éѯ
ÒÀ´Î½â¾öÁËÒÔÉÏÎÊÌâÖ®ºó£¬ÔÙÀ´²éÕÒ³ÌÐò·½ÃæµÄÎÊÌâ
my.cnf»º´æÓÅ»¯
ÔÚ my.cnf ÖÐÌí¼Ó/ÐÞ¸ÄÒÔÏÂÑ¡Ïî:
#È¡ÏûÎļþϵͳµÄÍⲿËø
skip-locking
#²»½øÐÐÓòÃû·´½âÎö,×¢ÒâÓÉ´Ë´øÀ´µÄȨÏÞ/ÊÚȨÎÊÌâ
skip-name-resolve
#Ë÷Òý»º´æ,¸ù¾ÝÄÚ´æ´óС¶ø¶¨,Èç¹ûÊǶÀÁ¢µÄdb·þÎñÆ÷,¿ÉÒÔÉèÖøߴï80%µÄÄÚ´æ×ÜÁ¿
key_buffer = 512M
#Á¬½ÓÅŶÓÁбí×ÜÊý
back_log = 200
max_allowed_packet = 2M
#´ò¿ª±í»º´æ×ÜÊý,¿ÉÒÔ±ÜÃâƵ·±µÄ´ò¿ªÊý¾Ý±í²úÉúµÄ¿ªÏú
table_cache = 512
#ÿ¸öÏß³ÌÅÅÐòËùÐèµÄ»º³å
sort_buffer_size = 4M
#ÿ¸öÏ̶߳ÁÈ¡Ë÷ÒýËùÐèµÄ»º³å
read_buffer_size = 4M
#MyISAM±í·¢Éú±ä»¯Ê±ÖØÐÂÅÅÐòËùÐèµÄ»º³å
myisam_sort_buffer_size = 64M
#»º´æ¿ÉÖØÓõÄÏß³ÌÊý
thread_cache = 128
#²éѯ½á¹û»º´æ
query_cache_size = 128M
#ÉèÖó¬Ê±Ê±¼ä,ÄܱÜÃⳤÁ¬½Ó
set-variable = wait_timeout=60
#×î´ó²¢·¢Ïß³ÌÊý,cpuÊýÁ¿*2
thread_concurrency = 4
#¼Ç¼Âý²éѯ,È»ºó¶ÔÂý²éѯһһÓÅ»¯
log-slow-queries = slow.log
long_query_time = 1
#¹Ø±Õ²»ÐèÒªµÄ±íÀàÐÍ,Èç¹ûÄãÐèÒª,¾Í²»Òª¼ÓÉÏÕâ¸ö
skip-innodb
skip-bdb
from£ºhttp://www.wangmeng.cn/Article/DATABASE/MySQL/200705/1220.html
Ïà¹ØÎĵµ£º
µÇ½ÒÔºóÔËÐÐÒÔÏÂÃüÁ¸øÓèÔ¶³Ì·ÃÎÊ¿Í»§¶ËȨÏÞ..
grant all on *.* to 'remote'@'172.16.21.39' identified by 'password';
remote±íʾÓû§Ãû.
'172.16.21.39' Ô¶³ÌipµØÖ·
password±íʾԶ³ÌµÇ½ÃÜÂë.
ĬÈÏ×´¿öÏ£¬³öÓÚ°²È«¿¼ÂÇ£¬mysqlÊý¾Ý¿âÆÁ±ÎÁËÔ¶³Ì·ÃÎʹ¦ÄÜ¡£ È»¶øÔÚÐí¶à×´¿öÏ£¬ÄãÐèÒªÔÚ¼Ò
»òÕß´Óweb³ÌÐòÈ¥·ÃÎÊ ......
1¡¢MySQL³£ÓÃÃüÁî
create database name; ´´½¨Êý¾Ý¿â
use databasename; Ñ¡ÔñÊý¾Ý¿â
drop database name Ö±½Óɾ³ýÊý¾Ý¿â£¬²»ÌáÐÑ
show tables; ÏÔʾ±í
describe tablename; ±íµÄÏêϸÃèÊö
select ÖмÓÉÏdistinctÈ¥³ýÖظ´×Ö¶Î
mysqladmin drop databasename ɾ³ýÊý¾Ý¿âÇ°£¬ÓÐÌáʾ¡£
ÏÔʾµ±Ç°mysql°æ±¾ºÍµ±Ç°È ......
Ò»¡¢MySQL »ñµÃµ±Ç°ÈÕÆÚʱ¼ä º¯Êý
select now();
+---------------------+
| now() |
+---------------------+
| 2008-08-08 22:20:46 |
+---------------------+
³ýÁË now() º¯ÊýÄÜ»ñµÃµ±Ç°µÄÈÕÆÚʱ¼äÍ⣬MySQL Öл¹ÓÐÏÂÃæµÄ ......
ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec …]
alter_specification:
ADD [COLUMN] create_definition [FIRST | AFTER column_name ]
or ADD INDEX [index_name] (index_col_name,…)
or ADD PRIMARY KEY (index_col_name,&hell ......