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

MySQL µ¼Èëµ¼³öÃüÁî

      ×î½ü±ðÈËÔÚ¸øÎÒ sql Îļþʱ¼òµ¥µÄÌáÁËÏ µ¼Èë/µ¼³ö ÃüÁÔÚ´Ë»ù´¡ÉÏѧϰÁËÏ£¬×ܽᵽ myhere¡£
    ¹æ¶¨£º
Óû§Ãû£ºdb_user
Õʺţº db_pass
Êý¾Ý¿â£º db_name
񡜧 table_name_1, table_name_2
    ˵Ã÷£º  һЩ²Ù×÷ÐèÒªÓÐÊʵ±µÄȨÏÞ¡£
1. µ¼³ö
mysqldump -udb_name -pdb_pass db_name > db_name.bak.sql
// µ¼³öÕû¸öÊý¾Ý¿â db_name
// ÎļþĬÈϱ£´æÔÚÖ´ÐÐ mysql ÃüÁîµÄĿ¼
mysqldump -udb_name -pdb_pass db_name table_name_1 > db_bame-table_name_1.bak.sql
// µ¼³öÊý¾Ý¿â db_name Öбí table_name_1
// ÎļþĬÈϱ£´æÔÚÖ´ÐÐ mysql ÃüÁîµÄĿ¼
// ˵Ã÷£ºµ¼³öµÄÎļþÊǺ¬Óн¨±íÓï¾äµÄ¡£
2. µ¼Èë
mysql -udb_name -pdb_pass db_name < table_name_1.bak.sql
// µ¼Èë±íµ½Êý¾Ý¿â db_name
// ÔÚûÓÐÁ¬½ÓÊý¾ÝµÄʱºòµ¼Èë
// ÎļþĬÈÏÔÚÖ´ÐÐ mysql ÃüÁîµÄĿ¼
source table_name_1.bak.sql
// ÒѾ­Á¬½ÓºÃÊý¾Ý¿â·þÎñÆ÷£¬²¢ÇÒÑ¡ÔñÁËÊý¾Ý¿â use db_name
// ÎļþĬÈÏÔÚÖ´ÐÐ mysql ÃüÁîµÄĿ¼
// ˵Ã÷£º µ¼ÈëµÄÎļþÐèÊǺ¬Óмû±íÓï¾äµÄ¡£
3. select...into outfile select * from table_name_1 limit 20 into outfile 'db_name-table_name_1.bak.sql'
// ÎļþĬÈϵ¼³öµ½·þÎñÆ÷Êý¾Ý¿â db_name ËùÔÚĿ¼
select * from table_name_2 into outfile 'F:/db_name-table_name_1.bak2.sql'
// µ¼³öµ½ F Ŀ¼ÏÂ
// ˵Ã÷£º
// * ÕâÖÖ·½Ê½µ¼³öµÄÖ»ÓÐÊý¾Ý£¬ÊDZíÖеÄÒ»ÐÐÒ»ÐеÄÊý¾Ý
// * ÎļþÃû±ØÐëÓÃÒýºÅÒýÆðÀ´
4. load data infile...from  load data infile 'db_name-table_name_1.bak.sql' into table table_name_1
// µ¼ÈëÊý¾Ýµ½ db_name Öбí table_name_1
// ÐèÏÈÑ¡ÖÐ db_name£¬
// ĬÈÏ db_name-table_name_1.bak.sql ·ÅÔÚ·þÎñÆ÷Êý¾Ý¿â db_name Ŀ¼ÏÂ
load data infile 'F:/db_name-table_name_1.bak2.sql' into table table_name_1
//
load data local infile 'F:/db_name-table_name_1.bak.sql' into table table_name_1
// ¼Ó local,ÎļþÏȱ»¿Í»§Ö÷»úÉϵĿͻ§¶Ë¶ÁÈ¡£¬È»ºó·¢µ½·þÎñÆ÷
// Òò´ËʹÓà local ËٶȻáÉÔÂý


Ïà¹ØÎĵµ£º

ÕýÈ·Àí½âMysqlµÄÁÐË÷ÒýºÍ¶àÁÐË÷Òý

  MysqlÊý¾Ý¿âÌṩÁ½ÖÖÀàÐ͵ÄË÷Òý£¬Èç¹ûûÕýÈ·ÉèÖã¬Ë÷ÒýµÄÀûÓÃЧÂÊ»á´ó´òÕÛ¿ÛÈ´ÍêÈ«²»ÖªÎÊÌâ³öÔÚÕâ¡£
CREATE TABLE test (
id INT NOT NULL,
last_name CHAR(30) NOT NULL,
first_name CHAR(30) NOT NULL,
PRIMARY KEY (id),
INDEX name (last_name,first_name)
);
ÒÔÉÏ´ ......

mysql×Ö·û¼¯Ð£Ñé¹æÔò

                                                   ......

MYSQL Êֲ᡾ժ¡¿

 20 MySQL¿Í»§¹¤¾ßºÍAPI
20.1 MySQL C API
C API´úÂëÊÇËæMySQL·Ö·¢µÄ£¬Ëü±»°üº¬ÔÚmysqlclient¿âÇÒÔÊÐíC³ÌÐò´æÈ¡Ò»¸öÊý¾Ý¿â¡£
ÔÚ MySQLÔ´´úÂë·Ö·¢Öеĺܶà¿Í»§ÊÇÓÃC±àдµÄ¡£Èç¹ûÄãÕýÔÚÑ°ÕÒÑÝʾÔõÑùʹÓÃC APIµÄÀý×Ó£¬¿´Ò»ÏÂÕâЩ¿Í»§³ÌÐò¡£
´ó¶àÊýÆäËû¿Í»§ API(³ýÁËJavaµÄËùÓÐ)¶¼Ê¹ÓÃmysqlclient¿âÓëMySQL·þÎñÆ÷ͨÐÅ ......

[ת]mysqlÖÐdata_format()

DATE_FORMAT(date,format)
¸ù¾Ýformat×Ö·û´®¸ñʽ»¯dateÖµ¡£ÏÂÁÐÐÞÊηû¿ÉÒÔ±»ÓÃÔÚformat×Ö·û´®ÖУº %M ÔÂÃû×Ö(January……December)
%W ÐÇÆÚÃû×Ö(Sunday……Saturday)
%D ÓÐÓ¢Óïǰ׺µÄÔ·ݵÄÈÕÆÚ(1st, 2nd, 3rd, µÈµÈ¡££©
%Y Äê, Êý×Ö, 4 λ
%y Äê, Êý×Ö, 2 λ
%a ËõдµÄÐÇÆÚÃû×Ö(Sun&h ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ