Mysql×Ö·û±àÂëÂÒÂë½â¾ö·½·¨
µ¼³öÊÇ,ûÓÐÖ¸¶¨±àÂë
·½·¨Ò» phpmyadmin´¦Àí·½Ê½
¼ì²éphp-mbstringÊÇ·ñÓпÉ×°,ûÓа²×°ÉÏ yum -y install php-mbstring
´ò¿ªphpmyadmin Öе¼³ö,ÔÙ´Óphpmyadmin µ¼ÈëÊÇѡȡ¶þÖÆ½ø(binary)
Èç¹û»¹²»ÐÐ,ÔÚmy.cnf mysqldÖмÓÈë default-character=ÄãµÄ±àÂë, ÖØÆômysql ÔÙÊÔ
·½·¨¶þ mysqldump ´¦Àí·½Ê½
µ¼³ö·½Ê½
mysqldump -u root -p --default-character-set=±àÂë Êý¾ÝÃû³Æ> file.sql
Àý
mysqldump -u root -p --default-character-set=big5 discuss_chi> dis.sql
---------------------
µ¼È뷽ʽ
mysqldump -u root -p --default-character-set=±àÂë Êý¾ÝÃû³Æ< file.sql
Àý
mysql -u root -p --default-character-set=binary -f discuss_chi<file.sql
Ò²¿ÉÒÔ
mysql -u root -p --default-character-set=big5 -f discuss_chi<dis.sql
µ«Êǽ¨ÒéʹÓöþ½øÖÆ,°²È«D!
·½·¨Èý£º
ÒÔÔÀ´µÄ×Ö·û¼¯Îªlatin1ΪÀý£¬Éý¼¶³ÉΪutf8µÄ×Ö·û¼¯¡£ÔÀ´µÄ±í: old_table (default charset=latin1)£¬ÐÂ±í£ºnew_table(default charset=utf
µÚÒ»²½£ºµ¼³ö¾ÉÊý¾Ý
mysqldump --default-character-set=latin1 -h localhost -u root -B my_db --tables old_table > old.sql
µÚ¶þ²½£º×ª»»±àÂë(ÀàËÆunix/linux»·¾³ÏÂ)
iconv -f gb2312 -t utf-8 -c old.sql > new.sql
»òÕß¿ÉÒÔÈ¥µô -f ²ÎÊý£¬ÈÃiconv×Ô¶¯ÅжÏÔÀ´µÄ×Ö·û¼¯
iconv -t utf-8 -c old.sql > new.sql
ÔÚÕâÀ¼Ù¶¨ÔÀ´µÄÊý¾ÝĬÈÏÊÇgb2312±àÂë¡£
µÚÈý²½£ºµ¼Èë
ÐÞ¸Äold.sql£¬ÔÚ²åÈë/¸üÐÂÓï¾ä¿ªÊ¼Ö®Ç°£¬Ôö¼ÓÒ»ÌõsqlÓï¾ä£º
"SET NAMES utf8;"
mysql -h localhost -u root -p my_db > new.sql
Ïà¹ØÎĵµ£º
Ò»¡¢MySQL »ñµÃµ±Ç°ÈÕÆÚʱ¼ä º¯Êý
1.1 »ñµÃµ±Ç°ÈÕÆÚ+ʱ¼ä£¨date + time£©º¯Êý£ºnow()
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2008-08-08 22:20:46 |
+---------------------+
³ýÁË now() º¯ÊýÄÜ»ñµÃµ±Ç°µÄÈÕÆÚʱ¼äÍ⣬MySQL Öл¹ÓÐÏÂÃæµÄº¯Êý£º ......
ÓÃÔÚSELECTºÍWHERE×Ó¾äµÄº¯Êý
--------------------------------------------------------------
1 ·Ö×麯Êý
( ... ) À¨ºÅ¡£Ê¹ÓÃËüÃÇÀ´Ç¿ÖÆÔÚÒ»¸ö±í´ïʽµÄ¼ÆËã˳Ðò¡£
--------------------------------------------------------------
2 ³£ÓõÄËãÊõÔËËã
£¨+ - * /£©
Ò»°ãµÄË ......
Ò» . °²×°ÓëÅäÖÃMYSQL
¶þ . ³£ÓÃmysqlÃüÁîÐÐÃüÁî
1 .mysqlµÄÆô¶¯ÓëÍ£Ö¹
Æô¶¯MYSQL·þÎñ net start mysql
Í£Ö¹MYSQL·þÎñ net stop mysql
2 . netstat –na | findstr 3306 ²é¿´±»¼àÌýµÄ¶Ë¿Ú , findstrÓÃÓÚ²éÕÒºóÃæµÄ¶Ë¿ÚÊÇ·ñ´æÔÚ
3 . ÔÚÃüÁîÐÐÖеǽMYSQL¿ØÖÆÌ¨ , ¼´Ê¹Óà MYSQL COMMEND LINE TOOL
& ......
Query ProfilerÊÇMYSQL×Ô´øµÄÒ»ÖÖqueryÕï¶Ï·ÖÎö¹¤¾ß£¬Í¨¹ýËü¿ÉÒÔ·ÖÎö³öÒ»ÌõSQLÓï¾äµÄÐÔÄÜÆ¿¾±ÔÚʲôµØ·½¡£Í¨³£ÎÒÃÇÊÇʹÓõÄexplain,ÒÔ¼°slow query log¶¼ÎÞ·¨×öµ½¾«È··ÖÎö£¬µ«ÊÇQuery ProfilerÈ´¿ÉÒÔ¶¨Î»³öÒ»ÌõSQLÓï¾äÖ´Ðеĸ÷ÖÖ×ÊÔ´ÏûºÄÇé¿ö£¬±ÈÈçCPU£¬IOµÈ£¬ÒÔ¼°¸ÃSQLÖ´ÐÐËùºÄ·ÑµÄʱ¼äµÈ¡£²»¹ý¸Ã¹¤¾ßÖ»ÓÐÔÚMYSQL 5.0.37ÒÔ ......
http://www.mysql.cn/
ÊÂÎñ£¬²ÎÊý£¬Ç¶Ì×µ÷Óã¬Óα꣬ѻ·, ´¥·¢Æ÷£¬ÊÓͼ£¬Ô¼Êø, Ë÷Òý£¬¡£¡£¡£
1. ´´½¨ÊµÀýÊý¾Ý¿â
create database db5;
use db5;
2.´´½¨Ò»¸ö¼òµ¥µÄ¹¤×÷±í,²¢²åÈëÊý¾Ý
create table t(s1 int);
insert into t values(5);
3.´´½¨³ÌÐòʵÀý crea ......