MYSQL·Ö±íÓÅ»¯
ÎÒÃǵÄÏîÄ¿ÖÐÓкö಻µÈÓÚµÄÇé¿ö¡£½ñÌìдÕâƪÎÄÕ¼òµ¥µÄ·ÖÎöÒ»ÏÂÔõô¸öÓÅ»¯·¨¡£
ÕâÀïµÄ·Ö±íÂß¼ÊǸù¾Ýt_group±íµÄuser_name×éµÄ¸öÊýÀ´·ÖµÄ¡£
ÒòΪÕâÖÖÇé¿öµ¥¶Àuser_name×Ö¶ÎÉϵÄË÷Òý¾ÍÊôÓÚÀÃË÷Òý¡£Æð²»ÁËɶÃûÃ÷ÏÔµÄЧ¹û¡£
1¡¢ÊÔÑéPROCEDURE.
DELIMITER $$
DROP PROCEDURE `t_girl`.`sp_split_table`$$
CREATE PROCEDURE `t_girl`.`sp_split_table`()
BEGIN
declare done int default 0;
declare v_user_name varchar(20) default '';
declare v_table_name varchar(64) default '';
-- Get all users' name.
declare cur1 cursor for select user_name from t_group group by user_name;
-- Deal with error or warnings.
declare continue handler for 1329 set done = 1;
-- Open cursor.
open cur1;
while done <> 1
do
fetch cur1 into v_user_name;
if not done then
-- Get table name.
set v_table_name = concat('t_group_',v_user_name);
-- Create new extra table.
set @stmt = concat('create table ',v_table_name,' like t_group');
prepare s1 from @stmt;
execute s1;
drop prepare s1;
-- Load data into it.
set @stmt = concat('insert into ',v_table_name,' select * from t_group where user_name = ''',v_user_name,'''');
prepare s1 from @stmt;
execute s1;
drop prepare s1;
end if;
end while;
-- Close cursor.
close cur1;
-- Free variable from memory.
set @stmt = NULL;
END$$
DELIMITER ;
2¡¢ÊÔÑé±í¡£
ÎÒÃÇÓÃÒ»¸öÓÐһǧÍòÌõ¼Ç¼µÄ±íÀ´×ö²âÊÔ¡£
mysql> select count(*) from t_group;
+----------+
| count(*) |
+----------+
| 10388608 |
+----------+
1 row in set (0.00 sec)
±í½á¹¹¡£
mysql> desc t_group;
+-------------+------------------+------+----
Ïà¹ØÎĵµ£º
mysql> SOURCE [·¾¶]ÎļþÃû
ÓÐÁ½ÖÖд·¨£º
1¡¢
mysql> SOURCE cr_pet_tbl.sql
Õâ¸öʱºò£¬cr_pet_tbl.sql±ØÐë·ÅÔÚÄãµÄmysql/binĿ¼ÏÂÃ棬¼´¸úmysql.exeͬһĿ¼
2¡£
mysql> SOURCE c:\cr_pet_tbl.sql
Õâ¸öʱºòλÖÃλÖÃÕýÈ·¼´¿É£¬ ......
mysqldump -uÓû§Ãû -pÃÜÂë Êý¾Ý¿âÃû >dumpÎļþµÄ·¾¶ºÍÃû³Æ
mysql> source dump.sql
There are three general ways to invoke mysqldump:
shell> mysqldump [options] db_name [tbl_name ...]
shell> mysqldump [options] --databases db_name ...
shell> mysqldump [options] --all-databases
......
MysqlÔÚÔËÐÐÒ»¶Îʱ¼äºó£¬Ëæ×Å¿âÈÝÁ¿µÄÔö´ó£¬±íµÄÔö¶à£¬ÓеÄʱºòÒòΪµôµç»òÕßÆäËûÔÒòµ¼ÖÂÊý¾Ý¿âËð»µ,±ÈÈ磺 ¼ì²éÓÅ»¯²¢ÐÞ¸´ËùÓеÄÊý¾Ý¿â£¬ÎÒÃÇ¿ÉÒÔʹÓÃmysql×Ô´øµÄmysqlcheckÃüÁîÀ´¿ìËÙÐÞ¸´ËùÓеÄÊý¾Ý¿â»òÕßÌض¨µÄÊý¾Ý¿â; ½øÈëMysqlµÄBinĿ¼£ºd:\MySQL\MySQL Server 4.1\bin or /usr/bin/
(ls my* ÏÔʾmy¿ªÍ·µÄÎļþ£© ......
2010-06-01 10:23
Êý¾ÝÀàÐÍ
ÃèÊö
×Ö½Ú
ÍƼöʹÓÃ
SMALLINT
ÕûÊý£¬´Ó-32000µ½ +32000·¶Î§
2
´æ´¢Ïà¶Ô±È½ÏСµÄÕûÊý¡£
±ÈÈç: Äê¼Í£¬ÊýÁ¿
INT
ÕûÊý£¬´Ó-2000000000 µ½ +2000000000 ·¶Î§
4
´æ´¢ÖеÈÕûÊý
ÀýÈç: ¾àÀë
BIGINT
²»ÄÜÓÃSMALLINT »ò INTÃèÊöµÄ³¬´óÕûÊý¡£
8
´æ´¢³¬´óµÄÕûÊý
ÀýÈç: ¿Æѧ/ÊýѧÊý¾Ý
FLOA ......
mysql noinstall°æ°²×°
1¡¢Èí¼þµÄÏÂÔØ
¡¡¡¡µ½mysqlµÄ¹Ù·½ÍøÕ¾ÏÂÔØMySQLµÄ½âѹ°ü£¬Èçmysql-noinstall-5.0.51b-win32.zip
¡¡¡¡È»ºó½«Æä½âѹµ½ÄãÏ£ÍûÊý¾Ý¿âËùÔÚµÄij¸öλÖã¬ÈçC:\
¡¡¡¡ÕâÑùÔÚC:ÅÌÏÂÃæ¾ÍÓÐÁËC:\mysql-5.0.51b-win32ÕâÑùµÄÒ»¸öĿ¼£¬ÀïÃæ¾ÍÊÇMySQLÊý¾Ý¿âµÄÈ«²¿ÄÚÈÝ¡£
2¡¢ÅäÖÃ
¡¡¡¡Ê×ÏÈÎÒÃÇÀ´¿´MySQLµÄ¸ùÄ¿Â ......