MYSQL Íâ¼ü¶¨Òå
½¨Á¢Íâ¼üµÄÇ°Ì᣺ ±¾±íµÄÁбØÐëÓëÍâ¼üÀàÐÍÏàͬ(Íâ¼ü±ØÐëÊÇÍâ±íÖ÷¼ü)¡£
Íâ¼ü×÷Ó㺠ʹÁ½ÕűíÐγɹØÁª£¬Íâ¼üÖ»ÄÜÒýÓÃÍâ±íÖеÄÁеÄÖµ£¡
Ö¸¶¨Ö÷¼ü¹Ø¼ü×Ö£º foreign key(ÁÐÃû)
ÒýÓÃÍâ¼ü¹Ø¼ü×Ö£º references <Íâ¼ü±íÃû>(Íâ¼üÁÐÃû)
ʼþ´¥·¢ÏÞÖÆ: on deleteºÍon update , ¿ÉÉè²ÎÊýcascade(¸úËæÍâ¼ü¸Ä¶¯), restrict(ÏÞÖÆÍâ±íÖеÄÍâ¼ü¸Ä¶¯),set Null(Éè¿ÕÖµ£©,set Default£¨ÉèĬÈÏÖµ£©,[ĬÈÏ]no action
ÀýÈ磺
outTable±í Ö÷¼ü id ÀàÐÍ int
´´½¨º¬ÓÐÍâ¼üµÄ±í£º
create table temp(
id int,
name char(20),
foreign key(id) references outTable(id) on delete cascade on update cascade);
˵Ã÷£º°ÑidÁÐ ÉèΪÍâ¼ü ²ÎÕÕÍâ±íoutTableµÄidÁÐ µ±Íâ¼üµÄֵɾ³ý ±¾±íÖжÔÓ¦µÄÁÐɸ³ý µ±Íâ¼üµÄÖµ¸Ä±ä ±¾±íÖжÔÓ¦µÄÁÐÖµ¸Ä±ä¡£
Ïà¹ØÎĵµ£º
1.CREATE USER
CREATE USER user [IDENTIFIED BY [PASSWORD] 'password']
[, user [IDENTIFIED BY [PASSWORD] 'password']] ...
CREATE USERÓÃÓÚ´´½¨ÐµÄMySQLÕË»§¡£ÒªÊ¹ÓÃCREATE USER£¬Äú±ØÐëÓµÓÐmysqlÊý¾Ý¿âµÄÈ«¾ÖCREATE USERȨÏÞ£¬»òÓµÓÐINSERTȨÏÞ¡£¶ÔÓÚÿ¸öÕË»§£¬CREATE USER»áÔÚûÓÐȨÏÞµÄmysq ......
×î½üÓöµ½Ò»¸öÐèÇóÒªÔÚlinuxÏÂÓÃjava µ÷ÓÃmysql¿Í»§¶ËÔ¶³ÌµÇ½mysql·þÎñÆ÷£¬´Ó¿Í»§¶Ë»úÆ÷µ¼Èëmysql½Å±¾£¬´Ómysql·þÎñÆ÷¶Ëµ¼³ö±íÖеÄÊý¾Ý¡£ÒÔÏÂÊÇÓõ½µÄÖ÷Òª·½·¨£º
Java ´úÂë
/**
* µ¼ÈëÊý¾Ý
* @param ½Å±¾µÄµØÖ·ºÍÃû³Æ
* @return ÊÇ·ñ³ ......
Õª³×Ô£ºhttp://database.ctocio.com.cn/153/9232653.shtml
ºÜ¶àʱºò¹ØÐĵÄÊÇÓÅ»¯SELECT ²éѯ£¬ÒòΪËüÃÇÊÇ×î³£ÓõIJéѯ£¬¶øÇÒÈ·¶¨ÔõÑùÓÅ»¯ËüÃDz¢²»×ÜÊÇÖ±½ØÁ˵±¡£Ïà¶ÔÀ´Ëµ£¬½«Êý¾Ý×°ÈëÊý¾Ý¿âÊÇÖ±½ØÁ˵±µÄ¡£È»¶ø£¬Ò²´æÔÚ¿ÉÓÃÀ´¸ÄÉÆÊý¾Ý×°ÔزÙ×÷ЧÂʵIJßÂÔ£¬Æä»ù±¾ÔÀíÈçÏ£º
¡¡¡¡³ÉÅú×°Ôؽϵ¥ÐÐ×°Ôظü¿ì£¬ÒòΪÔÚ×°ÔØÿ¸ö¼Ç ......
×î½ü¹¤×÷Éϳ£Óõ½MySQL£¬·¢ÏÖMySQLµÄ´íÎóÌáʾÒô±È½Ï·³ÈË£¬ÉÏÍøËÑË÷ÁËһϣ¬ÓÐÒÔÏÂÈýÖֹرոÃÌáʾÒôµÄ·½·¨£º
·½·¨1. ʹÓÃÖÕ¶ËÃüÁî
ʹÓÃMySQLµÄÃüÁîÖÕ¶Ëʱ£¬Ê¹ÓÃmysql --no-beep¼´¿É¡£
·½·¨2. ÐÞ¸ÄMySQLÅäÖÃÎļþmy.ini
ÔÚ[mysql] ϼÓÈëÒ»ÐÐ
no-beep
&nb ......
Ò»¡¢ÎÊÌâµÄÌá³ö
¡¡¡¡ÔÚÓ¦ÓÃϵͳ¿ª·¢³õÆÚ£¬ÓÉÓÚ¿ª·¢Êý¾Ý¿âÊý¾Ý±È½ÏÉÙ£¬¶ÔÓÚ²éѯSQLÓï¾ä£¬¸´ÔÓÊÓͼµÄµÄ±àдµÈÌå»á²»³öSQLÓï¾ä¸÷ÖÖд·¨µÄÐÔÄÜ¡£ÓÅÁÓ£¬µ«ÊÇÈç¹û½«Ó¦ÓÃϵͳÌύʵ¼ÊÓ¦Óúó£¬Ëæ×ÅÊý¾Ý¿âÖÐÊý¾ÝµÄÔö¼Ó£¬ÏµÍ³µÄÏìÓ¦ËٶȾͳÉΪĿǰϵͳÐèÒª½â¾öµÄ×îÖ÷ÒªµÄÎÊÌâÖ®Ò»¡£ÏµÍ³ÓÅ»¯ÖÐÒ»¸öºÜÖØÒªµÄ·½Ãæ¾ÍÊÇSQLÓï¾äµÄÓÅ»¯¡£¶ÔÓ ......