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

mysqlÈÕÖ¾³õ̽

mysqlÀï×î³£ÓõÄÈÕÖ¾ÓÐ4ÖÖ,·Ö±ðÊÇ:´íÎóÈÕÖ¾,¶þ½øÖÆÈÕÖ¾,²éѯÈÕÖ¾ÒÔ¼°Âú²éѯÈÕÖ¾. 1.´íÎóÈÕÖ¾»á¼Ç¼µ±mysqlÆô¶¯ºÍ¹Ø±ÕÒÔ¼°ÔËÐÐÖеĴíÎóÐÅÏ¢,¿ÉÒÔʹÓà --log-error[=file_name]À´Ö¸¶¨´íÎóÈÕÖ¾´æ·ÅÎļþ.µ±mysql serverÒì³£µÄʱºòÓ¦¸ÃÊ×ÏȲ鿴¸ÃÈÕÖ¾.ÆäʵÀïÃæҲûʲô,ÎÒÓ¢ÓïËļ¶Ã»¹ý,ÅäÉÏ´Ê°ÔĿǰΪֹ»¹Ã»ÓÐÅöµ½½â¾ö²»Á˵ÄÎÊÌâ,ºÇºÇ.ĬÈÏÊÇ´æ·ÅÔÚdatadirÀïµÄÖ÷»úÃû.err. 2.¶þ½øÖÆÈÕÖ¾´æ·ÅÁËËùÓеÄddlºÍdml²Ù×÷¼Ç¼ --log-bin[=file_name]Ñ¡ÏîÆô¶¯Ê±£¬mysqldдÈë°üº¬ËùÓиüÐÂÊý¾ÝµÄSQLÃüÁîµÄÈÕÖ¾Îļþ¡£Èç¹ûδ¸ø³öfile_nameÖµ£¬ ĬÈÏÃûΪ-binºóÃæËù¸úµÄÖ÷»úÃû¡£¶þ½øÖÆÈÕÖ¾²¢²»¿ÉÒÔÖ±½Ó²é¿´,ÐèÒª¿Í»§¶Ë¹¤¾ßmysqlbinlog log-file ²é¿´ mysqldÔÚÿ¸ö¶þ½øÖÆÈÕÖ¾ÃûºóÃæÌí¼ÓÒ»¸öÊý×ÖÀ©Õ¹Ãû¡£Ã¿´ÎÄãÆô¶¯·þÎñÆ÷»òË¢ÐÂÈÕ־ʱ¸ÃÊý×ÖÔòÔö¼Ó¡£Èç¹ûµ±Ç°µÄÈÕÖ¾´óС´ïµ½max_binlog_size£¬»¹»á×Ô¶¯´´½¨ÐµĶþ½øÖÆÈÕÖ¾¡£Èç¹ûÄãÕýʹÓôóµÄÊÂÎñ£¬¶þ½øÖÆÈÕÖ¾»¹»á³¬¹ýmax_binlog_size£ºÊÂÎñȫдÈëÒ»¸ö¶þ½øÖÆÈÕÖ¾ÖУ¬¾ø¶Ô²»ÒªÐ´È벻ͬµÄ¶þ½øÖÆÈÕÖ¾ÖС£ ΪÁËÄܹ»ÖªµÀ»¹Ê¹ÓÃÁËÄĸö²»Í¬µÄ¶þ½øÖÆÈÕÖ¾Îļþ£¬mysqld»¹´´½¨Ò»¸ö¶þ½øÖÆÈÕÖ¾Ë÷ÒýÎļþ£¬°üº¬ËùÓÐʹÓõĶþ½øÖÆÈÕÖ¾ÎļþµÄÎļþÃû¡£Ä¬ÈÏÇé¿öÏÂÓë¶þ½øÖÆÈÕÖ¾ÎļþµÄÎļþÃûÏàͬ£¬À©Õ¹ÃûΪ'.index'¡£Äã¿ÉÒÔÓÃ--log-bin-index[=file_name]Ñ¡Ïî¸ü¸Ä¶þ½øÖÆÈÕÖ¾Ë÷ÒýÎļþµÄÎļþÃû¡£µ±mysqldÔÚÔËÐÐʱ£¬²»Ó¦ÊÖ¶¯±à¼­¸ÃÎļþ£»Èç¹ûÕâÑù×ö½«»áʹmysqld±äµÃ»ìÂÒ¡£ ¿ÉÒÔÓÃÒÔÏÂÓï¾äɾ³ý¶þ½øÖÆÈÕÖ¾ reset master;#ɾ³ýËùÓжþ½øÖÆÈÕÖ¾ purge master logs to 'mysql-bin.******';#ɾ³ý******±àºÅ֮ǰµÄ¶þ½øÖÆÈÕÖ¾ purge master logs before 'yyyy-mm-dd hh24:mm:ss'#ɾ³ýÖ¸¶¨ÈÕÆÚ֮ǰµÄÈÕÖ¾ »¹¿ÉÒÔÉèÖÃ--expire_logs_days=*;#ÉèÖÃÈÕÖ¾¹ýÆÚÌìÊý,¹ýÆÚ×Ô¶¯É¾³ý. --binlog-do-db=db_name#Ö¸¶¨Êý¾Ý¿â¿ªÆô¶þ½øÖÆÈÕÖ¾,ÀàËƵÄÓÐignore. innodbÓÐ --innodb-safe-binlogÒÔ¼°--sync-binlog=n(ÿдn´ÎÈÕ־ͬ²½´ÅÅÌ) ¿ÉÒÔͨ¹ýset sql_log_bin=0½ûÓöþ½øÖÆÈÕÖ¾. 3.²éѯÈÕÖ¾,¼Ç¼ËùÓвéѯÓï¾ä,¶þ½øÖÆÈÕÖ¾²»¼Ç¼֮²éѯµÄÓï¾ä --log[=file_name]¿ÉÒÔÆô¶¯²éѯÈÕÖ¾,ĬÈÏÊÇÔÚdatadirÀïµÄÖ÷»úÃû.log,ÓÉÓÚ»áÏûºÄ´óÁ¿´ÅÅÌio×ÊÔ´,Ò»°ãÇé¿öϽ¨Òé½ûÓÃ. 4.Âý²éѯÈÕÖ¾ --log-slow-queries[=file_name]ĬÈÏÊÇÔÚdatadirϵÄÖ÷»úÃû.slow.log --log-short-format#ºöÂÔµô²»Ê¹ÓÃË÷ÒýµÄÂý²éѯ --log-slow-admin-statements#½«¼Ç¼Âý¹ÜÀíÓï¾ä set long_query_time=n;#


Ïà¹ØÎĵµ£º

php½Ì³Ì£ºmysqlµÄ³£ÓÃÓï¾ä

¹ØÓÚ PHP ½Ì³ÌµÄÎÄÕÂÒѾ­ºÜ¶àÁË£¬½ñÌì¸ø´ó¼Ò½éÉܼ¸¸ö³£ÓõÄMYSQLÓï¾ä¡£
ÏÔʾÊý¾Ý¿â»ò±í:
show databases;//È»ºó¿ÉÒÔuse database_name;
show tables;
¸ü¸Ä±íÃû:
alter table table_name rename new_t;
Ìí¼ÓÁÐ :
alter table table_name add column c_n column attributes;
ɾ³ýÁÐ:
alter table table_name ......

Apache + PHP + MySql °²×°


ËùÐèÈí¼þ£¨×¢Òâ°æ±¾£¡£©£º
Apache2.2.3 
PHP5.1.5 
MySQL5.0.24
ÕâÈý¸öÈí¼þ¶¼ÊÇÃâ·ÑµÄ£¬¿É´Ó¹ÙÍøÉÏÏÂÔØ£¬Ä¿Ç°ÎÒËùÓеÄÈí¼þÃûΪ£º
apache_2.2.3-win32-x86-no_ssl.msi 
mysql-5.0.24-win32.zip 
php-5.1.5-Win32.zip
»ùÓÚwindows²Ù×÷ϵͳ£¬ÔÚWindows XPÏ°²×°Ê¹Óãº
1¡¢°²×°¹ý³Ì£º  ......

MySQL£ºGrant Óï·¨Ïê½â£¨MySQL 5.X£©


±¾ÎÄʵÀý£¬ÔËÐÐÓÚ MySQL 5.0 ¼°ÒÔÉÏ°æ±¾¡£
MySQL ¸³ÓèÓû§È¨ÏÞÃüÁîµÄ¼òµ¥¸ñʽ¿É¸ÅÀ¨Îª£º
grant ȨÏÞ on Êý¾Ý¿â¶ÔÏó to Óû§
Ò»¡¢grant ÆÕͨÊý¾ÝÓû§£¬²éѯ¡¢²åÈë¡¢¸üС¢É¾³ý Êý¾Ý¿âÖÐËùÓбíÊý¾ÝµÄȨÀû¡£
grant select on testdb.* to common_user@'%'
grant insert on testdb.* to common_user@'%'
grant update o ......

ÈçºÎÐÞ¸ÄmysqlÊý¾Ý¿âµÄÁ¬½ÓÊý

а²×°ºóµÄmysqlÊý¾Ý¿â£¬ÆäĬÈϵÄ×î´óÁ¬½ÓÊýΪ100¡£
·½·¨Ò»£º
ÔÚmysql°²×°Â·¾¶Ï£¬ÕÒµ½my.ini»òÕßmy.cnfÎļþ£¬´ò¿ªËüÕÒµ½max_connections,ÉèÖóÉ1000; È»ºóÖØÆômysql·þÎñ¡£
·½·¨¶þ£º
ÔÚmysqlÔËÐл·¾³Ï£¬½øÈëmysqlÃüÁîÏ£º
mysql> set global max_connections=1000;
È»ºó¹Ø±ÕmysqlÖØÆôËü£»
ÔÚ./bin·¾¶Ï£¬Ê¹Óà # ......

mysql UDF+triggerµÄÉñÆæħÁ¦

  1.ʲôÊÇUDF? UDF(user-defined function)ÊÇmysqlΪÓû§ÌṩµÄ×Ô¶¨Ò庯ÊýµÄÀ©Õ¹½Ó¿Ú¡£Ëü±¾ÖÊÉϺÍmysqlÌṩµÄmax¡¢minºÍcountµÈº¯ÊýÀàËÆ¡£ 2.UDF¿ÉÒÔ×öʲô? UDFÊÇ×Ô¶¨Ò庯Êý£¬ËùÒÔËüÄÜ×öʲôÍêÈ«È¡¾öÓÚÄãµÄʵÏÖ¡£UDF¿ÉÒÔÔÚÆÕͨµÄsql¡¢triggerÒÔ¼°store procedure±»µ÷ÓᣠÈç¹û×Ô¶¨ÒåÒ»¸ötcp_send(ip,port,msg)µ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ