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

MYSQL³£ÓÃÃüÁîÁбí


MYSQL³£ÓÃÃüÁîÁбí
1¡¢ÏµÍ³¹ÜÀí
mysql -hÖ÷»úµØÖ· -uÓû§Ãû -p 
Á¬½ÓMYSQL£¨ÔÚmysql/bin£©
exit 
Í˳öMYSQLÃüÁî
mysqladmin -uÓû§Ãû -p¾ÉÃÜÂë passwordÐÂÃÜÂë 
ÐÞ¸ÄÃÜÂ루ÔÚmysql/bin£©
grantselect[insert][,update][,delete]onÊý¾Ý¿â.*toÓû§Ãû@localhost£¨"%"£¬ ±íʾÈκÎÖ÷»ú£©identifiedby "ÃÜÂë" 
Ôö¼ÓÓû§
mysqldump –u root –p optÊý¾Ý¿âÃû>±¸·ÝÎļþÃû 
±¸·ÝÊý¾Ý¿â£¨ÔÚmysql/bin£©
mysql –u root –p < batch file £¨ÀýÈ籸·ÝÎļþÃû£© 
ʹÓÃÅú´¦Àí
mysql.server start 
Æô¶¯·þÎñÆ÷
mysql.server stop 
Í£Ö¹·þÎñÆ÷
msql.server log
2¡¢²éѯÃüÁî
select version() 
²éѯ°æ±¾ºÅ
select current_date 
²éѯµ±Ç°ÈÕÆÚ
3¡¢ÏÔʾÃüÁî
show databases 
ÏÔʾÊý¾Ý¿âÁбí
show tables ÏÔʾ¿âÖеÄÊý¾Ý±í
describe ±íÃû ÏÔʾÊý¾Ý±íµÄ½á¹¹
select * from ±íÃû ÏÔʾ±íÖеļǼ
select what_to_select from which table [whereconditions_to_satisfy and (or) where conditions_to_satisfy] ´ÓÒ»¸ö±íÖмìË÷Êý¾Ý¡ºÂú×ãÌõ¼þ¡»
select ×Ö¶Î1,×Ö¶Î2,… from ±íÃû ÏÔʾÌض¨ÁеÄÖµ
select * from ±íÃû order by ×Ö¶ÎÃû ÅÅÐòÐÐ
select ×Ö¶Î1,°üº¬×Ö¶Î2µÄÔËËãʽas ÐÂ×ֶΠfrom ±íÃû ×Ö¶ÎÖµÔËËã²Ù×÷
select ×Ö¶Î1 is null£¨is not null£© ¿ÕÖµ²Ù×÷
Select*from±íÃûwhere×Ö¶ÎÃûlike£¨not like£© “ ×Ö·û” 
×¢£º ÔÊÐíʹÓÓ_”Æ¥ÅäÈκε¥¸ö×Ö·û£¬ ¶ø“£¥” Æ¥ÅäÈÎÒâÊýÄ¿×Ö·û ģʽƥÅä
Select * from±íÃûwhere×Ö¶ÎÃûregexp£¨not regexp£©»òÕßrlike£¨not rlike£© “.”Æ¥ÅäÈκε¥¸öµÄ×Ö·û Ò»¸ö×Ö·ûÀà[…]Æ¥Åä·½¿òÄÚÈκÎ×Ö·û¡£ÀýÈç[a]£¬[asd]£¬[az] Æ¥ÅäÈκÎСд×Öĸ£¬[09] Æ¥ÅäÈκÎÊý
×Ö¡£ “*”Æ¥ÅäÁã¸ö»òÕ߶à¸öÔÚËüÇ°ÃæµÄ¶«Î÷¡£ ÕýÔò±í´ïʽÇø·Ö´óСд[aA] ¡£ Èç¹ûËü³öÏÖÔÚ±»²âÊÔÖµµÄÈκεط½£¬Ä£Ê½¶¼Æ¥Åä¡£ ¶¨Î»£¬ÔÚģʽ¿ªÊ¼´¦ÓÓ^”£¬½áβ´¦ÓÓ$”£¬ÀýÈç“^b” 
À©Õ¹ÕýÔò±í´ïʽ
Select count(*) from ±íÃû 
Select ×Ö¶ÎÃû£¬count(*) from ±íÃû group by ×Ö¶ÎÃû ÐмÆÊý
4¡¢±à¼­ÃüÁî
use database ¿âÃû 
ʹÓõÄÊý¾Ý¿â
create database ¿âÃû 
´´½¨Êý¾Ý¿â
create table ±íÃû 
ÔÚÊý¾Ý¿âÖд´½¨±í
ins


Ïà¹ØÎĵµ£º

mysql´æ´¢ÒýÇæÖ® InnoDB

InnoDB¸ÅÊö
InnoDB¸øMySQLÌṩÁ˾ßÓÐÌá½»£¬»Ø¹öºÍ±ÀÀ£»Ö¸´ÄÜÁ¦µÄÊÂÎñ°²È«£¨ACID¼æÈÝ£©´æ´¢ÒýÇæ¡£InnoDBËø¶¨ÔÚÐм¶²¢ÇÒÒ²ÔÚSELECTÓï¾äÌṩһ¸öOracle·ç¸ñÒ»ÖµķÇËø¶¨¶Á¡£ÕâЩÌØÉ«Ôö¼ÓÁ˶àÓû§²¿ÊðºÍÐÔÄÜ¡£Ã»ÓÐÔÚInnoDBÖÐÀ©´óËø¶¨µÄÐèÒª£¬ÒòΪÔÚInnoDBÖÐÐм¶Ëø¶¨ÊʺϷdz£Ð¡µÄ¿Õ¼ä¡£InnoDBÒ²Ö§³ÖFOREIGN KEYÇ¿ÖÆ¡£ÔÚSQL²éÑ¯Ö ......

MySQL´¥·¢Æ÷

MySQL´¥·¢Æ÷
Ò»¡¢ MySQL´¥·¢Æ÷¸ÅÄî
MySQL5.0ÒÔÉÏ°æ±¾Ö§³Ö´¥·¢Æ÷£¬´¥·¢Æ÷ÊÇÓë±íÓйصÄÃüÃûÊý¾Ý¿â¶ÔÏ󣬵±±í³öÏÖÌض¨Ê¼þʱ£¬½«¼¤»î¸Ã¶ÔÏó¡£
¶þ¡¢ MySQL´¥·¢Æ÷Óï·¨
CREATE TRIGGER trigger_name trigger_time trigger_event
       ON tbl_name FOR EACH ROW trigger_stmt
trigger ......

ÈçºÎÖ´ÐÐÒ»¸ömysqlµÄsql½Å±¾Îļþ


2009-12-08 18:53
sql½Å±¾ÊÇ°üº¬Ò»µ½¶à¸ösqlÃüÁîµÄsqlÓï¾ä£¬ÎÒÃÇ¿ÉÒÔ½«ÕâЩsql½Å±¾·ÅÔÚÒ»¸öÎı¾ÎļþÖУ¨ÎÒÃdzÆ֮Ϊ“sql½Å±¾Îļþ”£©£¬È»ºóͨ¹ýÏà¹ØµÄÃüÁîÖ´ÐÐÕâ¸ösql½Å±¾Îļþ¡£»ù±¾²½ÖèÈçÏ£º
1¡¢´´½¨°üº¬sqlÃüÁîµÄsql½Å±¾Îļþ
ÎļþÖаüº¬Ò»Ð©ÁеÄsqlÓï¾ä£¬Ã¿ÌõÓï¾ä×îºóÒÔ;½á⣬ÎļþÄÚÈÝʾÀýÈçÏ£º
--´´½ ......

PHPÖеÄMYSQL³£Óú¯Êý×ܽá

PHPÖеÄMYSQL³£Óú¯Êý×ܽá
1¡¢mysql_connect()-½¨Á¢Êý¾Ý¿âÁ¬½Ó
¸ñʽ£º
    resource mysql_connect([string hostname [:port] [:/path/to/socket] [, string username] [, string password]])
Àý£º
    $conn = @mysql_connect("localhost", "username", "password") or dir( ......

mysqlÖеÄtinyint£¬smallint£¬int£¬bigint

bigint ´Ó -2^63 (-9223372036854775808) µ½ 2^63-1 (9223372036854775807) µÄÕûÐÍÊý¾Ý£¨ËùÓÐÊý×Ö£©¡£´æ´¢´óСΪ 8 ¸ö×Ö½Ú¡£
int ´Ó -2^31 (-2,147,483,648) µ½ 2^31 - 1 (2,147,483,647) µÄÕûÐÍÊý¾Ý£¨ËùÓÐÊý×Ö£©¡£´æ´¢´óСΪ 4 ¸ö×Ö½Ú¡£int µÄ SQL-92 ͬÒå×ÖΪ integer¡£
smallint ´Ó -2^15 (-32,768) µ½ 2^15 - 1 (32,7 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ