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

MYSQL[ÃüÁîÐÐÏÂ]µ¼Èëµ¼³ö´óÊý¾Ý·½·¨£¡


2007-11-16 15:37
½ñÌì¿´×ÅÊÖ²áÊÔÁËÏ£¬·¢ÏÖÔ­À´´óÊý¾Ýµ¼Èëµ¼³öÊÇÄÇôµÄÇáËÉ£¨²»ÊǺܴó£¬200¶àMµÄÎı¾¶øÒÔ£©
×¢Ò⣺Èç¹û·¢ÏÖMYSQL unknown command '\'ÕâÑùµÄÌáʾ£¬ÔòÉèÖÃһϷþÎñÆ÷µÄ×Ö·û¼¯£¬È磺
mysql -uroot -ppasspass --default-character-set=utf8 databaseName <d:bakcup.sql
ÕâÑù¾Í²»»á±¨´íÁË£¬^_^
µ¼³ö£º(mysqldump)
cmd>ϽøÐÐMysqlµÄ°²×°Ä¿Â¼£¬½øÈëbinĿ¼£¡
mysqldump -u root -p database_name > d:backup\bak_sql_name.sql
È»ºó»Ø³µ£¨ÆäÖУ¬-u mysqlµÄÓû§ -pΪÃÜÂë(¿Õ×Å) database_nameΪÐèÒª±¸·ÝµÄÊý¾ÝÃû£¬> ºóÃæ¾ÍÊǵØÖ·ÁË£¡£©
ÏêϸµÄ²ÎÊý£¬¿É¿´¹Ù·½Êֲᣡ
µ¼È룺£¨mysql£©
ÔÚmysqlµÄbinĿ¼Ï£¬¼üÈëmysql -u root -p database_name < d:backup\bak_sql_name.sql
ÌáʾÊäÈëÕýÈ·ÃÜÂë¾ÍOKÁË£¡
Ò²¿ÉÒÔ¼üÈëmysql -u root -p£¨µÇ½mysql¿ØÖÆ̨£¬ÓÃsource»ò\.ÃüÁî½øÐе¼È룡£©
mysql>source d:backup\bak_sql_name.sql
mysql>\. d:bakcup\bak_sql_name.sql
mysqldumpÓ÷¨¼¸Àý
2007/08/24 02:27 P.M.
£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½
¼¸¸ö³£ÓÃÓÃÀý£º
1.µ¼³öÕû¸öÊý¾Ý¿â
mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû > µ¼³öµÄÎļþÃû    
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
2.µ¼³öÒ»¸ö±í
mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû ±íÃû> µ¼³öµÄÎļþÃû
mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql
3.µ¼³öÒ»¸öÊý¾Ý¿â½á¹¹
    mysqldump -u wcnc -p -d --add-drop-table smgp_apps_wcnc >d:\wcnc_db.sql
-d ûÓÐÊý¾Ý --add-drop-table ÔÚÿ¸öcreateÓï¾ä֮ǰÔö¼ÓÒ»¸ödrop table
4.´øÓïÑÔ²ÎÊýµ¼³ö
   mysqldump -uroot -p --default-character-set=latin1 --set-charset=gbk --skip-opt databse > d4.sql
5.µ¼ÈëÊý¾Ý¿â
    ³£ÓÃsource ÃüÁî
    ½øÈëmysqlÊý¾Ý¿â¿ØÖÆ̨£¬
    Èçmysql -u root -p 
  
    mysql>use Êý¾Ý¿â
    È»ºóʹÓÃsourceÃüÁºóÃæ²ÎÊýΪ½Å±¾Îļþ£¨ÈçÕâÀïÓõ½µÄ.sql£©
    mysql>source d:\wcnc_db.sql
mysqldumpÖ§³ÖÏÂÁÐÑ¡Ï
–add-locks
ÔÚÿ¸ö±íµ¼³ö֮ǰÔö¼ÓLOCK TABLES²¢ÇÒÖ®ºóUNLOCK TABLE¡£(ΪÁËʹµÃ¸ü¿ìµØ²åÈ


Ïà¹ØÎĵµ£º

Nginx+PHP+MySQLË«»ú»¥±¸¡¢È«×Ô¶¯Çл»·½°¸

ÔÚÉú²úÓ¦ÓÃÖУ¬Ä³Ì¨“Nginx+PHP+MySQL”½Ó¿ÚÊý¾Ý·þÎñÆ÷£¬°çÑݵĽÇÉ«Ê®·ÖÖØÒª£¬Èç¹û·þÎñÆ÷Ó²¼þ»òNginx¡¢MySQL·¢Éú¹ÊÕÏ£¬¶ø ¶Ìʱ¼äÄÚÎÞ·¨»Ö¸´£¬ºó¹û½«·Ç³£ÑÏÖØ¡£ÎªÁ˱ÜÃâµ¥µã¹ÊÕÏ£¬ÎÒÉè¼ÆÁË´ËÌ×·½°¸£¬±àдÁËfailover.sh½Å±¾£¬ÊµÏÖÁËË«»ú»¥±¸¡¢È«×Ô¶¯Çл»£¬¹ÊÕÏתÒÆʱ¼ä Ö»Ð輸ʮÃë¡£
Ò»¡¢Ë«»ú»¥±¸¡¢È«×Ô¶¯Çл»·½°¸ ......

ÀûÓÃMySQLµÄÒ»¸öÌØÐÔʵÏÖMySQL²éѯ½á¹ûµÄ·ÖÒ³ÏÔʾ

ÔÚmysqlÖÐÀûÓÃselectÓï¾äµÄÒ»¸öÌØÐԾͿÉÒԺܷ½±ãµØʵÏÖ²éѯ½á¹ûµÄ·ÖÒ³£¬selectÓï¾äµÄÓï·¨£º
SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [HIGH_PRIORITY]
[DISTINCT | DISTINCTROW | ALL]
select_expression,...
[INTO OUTFILE 'file_name'&nb ......

MysqlÍü¼ÇrootÃÜÂëµÄ½â¾ö°ì·¨

ÔÚwindowsÏ£º
´ò¿ªÃüÁîÐд°¿Ú£¬Í£Ö¹mysql·þÎñ(»òÕßÔÚÈÎÎñ¹ÜÀíÆ÷Àï½áÊøµômysqld-nt.exe½ø³Ì)£º        Net stop mysql
Æô¶¯mysql£¬Ò»°ãµ½mysqlµÄ°²×°Â·¾¶£¬ÕÒµ½ mysqld-nt.exe
Ö´ÐУºmysqld-nt --skip-grant-tables
ÁíÍâ´ò¿ªÒ»¸öÃüÁîÐд°¿Ú£¬Ö´ÐÐmysql
use mysql
update us ......

mysql³öÏÖunauthenticated user¼òµ¥·ÖÎöÒÔ¼°½â¾ö

µ±ÓÃshow processlist;¿´µ½ÈçÏÂÐÅϢʱ:
LL | login | NULL             |
| 697 | unauthenticated user | 218.26.219.186:26944  | NULL       | Connect | NULL | login | NULL      & ......

mysql ÖРʱ¼äºÍÈÕÆÚº¯Êý

»ù´¡²¿·Ö
Ò»¡¢MySQL »ñµÃµ±Ç°ÈÕÆÚʱ¼ä º¯Êý
1.1 »ñµÃµ±Ç°ÈÕÆÚ+ʱ¼ä£¨date + time£©º¯Êý£ºnow()
mysql> select now();
+---------------------+
| now()               |
+----------------- ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ