mysqlÖÐsourceÏÂÁîµÄ×÷ÓÃ
source ÏÂÁîÔÚ mysql ÖÐÓÃÓÚÖ´ÐÐÍⲿÎļþÖÐµÄ sql Óï¾ä£¬¼ò»¯Êý¾Ý¿âÖÎÀíʹÃü£¬°üÀ¨×Ô¶¯»¯²Ù×÷¡¢¼ò»¯¾ç±¾Ö´ÐкÍÌá¸ß¿Éά»¤ÐÔ¡£
MySQL ÖÐ SOURCE ÏÂÁîµÄ×÷ÓÃ
SOURCE ÏÂÁîÔÚ MySQL ÖÐÓÃÓÚÖ´Ðд洢ÔÚÍⲿÎļþÖеÄһϵÁÐ SQL Óï¾ä¡£ËüÔÊÐíÓû§ÒÔÅúÁ¿·½·¨Ö´Ðо籾£¬´Ó¶ø¼ò»¯Êý¾Ý¿âÖÎÀíʹÃü¡£
ʹÓÃ˵Ã÷
SOURCE ÏÂÁîµÄÓï·¨ºÜ¼òÆÓ£º
SOURCE <filename>;</filename>
µÇ¼ºó¸´ÖÆ
ÆäÖÐ ÊÇ°üÀ¨ SQL Óï¾äµÄÍⲿÎļþ·¾¶¡£
×÷ÓÃ
SOURCE ÏÂÁîÖ´ÐÐÒÔϲÙ×÷£º
·¿ªÖ¸¶¨Îļþ¡£
¶ÁÈ¡²¢ÆÊÎöÎļþÖÐµÄ SQL Óï¾ä¡£
Ö´ÐÐÿ¸öÓï¾ä£¬¾ÍÏñÖ±½ÓÔÚ SQL ÌáÐÑ·ûÖÐÊäÈëÒ»Ñù¡£
ÀûÒæ
ʹÓà SOURCE ÏÂÁîÓÐÒÔÏÂÀûÒ棺
×Ô¶¯»¯Ê¹Ãü£ºËüÔÊÐíÓû§×Ô¶¯»¯Í¨³£ÐèÒªÊÖ¶¯Ö´ÐеÄһϵÁвÙ×÷¡£
¼ò»¯µÄ¾ç±¾Ö´ÐУºÓû§¿ÉÒÔ½« SQL ¾ç±¾´æ´¢ÔÚÍⲿÎļþÖУ¬²¢ÇáËɵØÔÚÐèҪʱִÐÐËüÃÇ¡£
¿Éά»¤ÐÔ£º½« SQL ¾ç±¾·ÅÔÚÎļþÖÐʹ´úÂë¸üÒ×ÓÚά»¤ºÍ°æ±¾¿ØÖÆ¡£
ʾÀý
¼ÙÉè±£´æÒ»¸öÃûΪ “create_tables.sql” µÄÎļþ£¬ÆäÖаüÀ¨ÒÔÏ SQL Óï¾ä£º
CREATE TABLE users ( id INT PRIMARY KEY, name VARCHAR(255) NOT NULL ); CREATE TABLE posts ( id INT PRIMARY KEY, title VARCHAR(255) NOT NULL, content TEXT NOT NULL );
µÇ¼ºó¸´ÖÆ
ÒªÖ´ÐÐÕâЩÓï¾ä£¬Óû§¿ÉÒÔÔËÐÐÒÔÏÂÏÂÁ
SOURCE create_tables.sql;
µÇ¼ºó¸´ÖÆ
Õ⽫ÆÊÎö²¢Ö´ÐÐÎļþÖÐµÄ SQL Óï¾ä£¬½¨Éè “users” ºÍ “posts” ±í¡£
ÒÔÉϾÍÊÇmysqlÖÐsourceÏÂÁîµÄ×÷ÓõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡