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

MySQL¸ßЧÔËÐбر¸£º¼òµ¥µÄ֪ʶ½ÌÄã¸ßЧÔËÓÃË÷Òý

ÔÚÊý¾Ý¿â±íÖУ¬¶Ô×ֶν¨Á¢Ë÷Òý¿ÉÒÔ´ó´óÌá¸ß²éѯËٶȡ£¼ÙÈçÎÒÃÇ´´½¨ÁËÒ»¸ö mytable±í£º
CREATE TABLE mytable(
ID INT NOT NULL,
username VARCHAR(16) NOT NULL
);
ÎÒÃÇËæ»úÏòÀïÃæ²åÈëÁË10000Ìõ¼Ç¼£¬ÆäÖÐÓÐÒ»Ìõ£º5555, admin¡£
ÔÚ²éÕÒusername="admin"µÄ¼Ç¼ SELECT * from mytable WHERE username='admin';ʱ£¬Èç¹ûÔÚusernameÉÏÒѾ­½¨Á¢ÁËË÷Òý£¬MySQLÎÞÐëÈκÎɨÃ裬¼´×¼È·¿ÉÕÒµ½¸Ã¼Ç¼¡£Ïà·´£¬MySQL»áɨÃèËùÓмǼ£¬¼´Òª²éѯ10000Ìõ¼Ç¼¡£
Ë÷Òý·Öµ¥ÁÐË÷ÒýºÍ×éºÏË÷Òý¡£µ¥ÁÐË÷Òý£¬¼´Ò»¸öË÷ÒýÖ»°üº¬µ¥¸öÁУ¬Ò»¸ö±í¿ÉÒÔÓжà¸öµ¥ÁÐË÷Òý£¬µ«Õâ²»ÊÇ×éºÏË÷Òý¡£×éºÏË÷Òý£¬¼´Ò»¸öË÷°üº¬¶à¸öÁС£
Ë÷ÒýµÄÀàÐÍ°üÀ¨£º
£¨1£©ÆÕͨË÷Òý
ÕâÊÇ×î»ù±¾µÄË÷Òý£¬ËüûÓÐÈκÎÏÞÖÆ¡£ËüÓÐÒÔϼ¸ÖÖ´´½¨·½Ê½£º
¡ñ     ´´½¨Ë÷Òý
CREATE INDEX indexName ON mytable(username(length));
Èç¹ûÊÇCHAR£¬VARCHARÀàÐÍ£¬length¿ÉÒÔСÓÚ×Ö¶Îʵ¼Ê³¤¶È£»Èç¹ûÊÇBLOBºÍTEXTÀàÐÍ£¬±ØÐëÖ¸¶¨ length£¬ÏÂͬ¡£
¡ñ     Ð޸ıí½á¹¹
ALTER mytable ADD INDEX [indexName] ON (username(length))
¡ñ     ´´½¨±íµÄʱºòÖ±½ÓÖ¸¶¨
CREATE TABLE mytable(
ID INT NOT NULL,
username VARCHAR(16) NOT NULL,
INDEX [indexName] (username(length))
);
ɾ³ýË÷ÒýµÄÓï·¨£º
DROP INDEX [indexName] ON mytable;
£¨2£©Î¨Ò»Ë÷Òý
ËüÓëÇ°ÃæµÄÆÕͨË÷ÒýÀàËÆ£¬²»Í¬µÄ¾ÍÊÇ£ºË÷ÒýÁеÄÖµ±ØÐëΨһ£¬µ«ÔÊÐíÓпÕÖµ¡£Èç¹ûÊÇ×éºÏË÷Òý£¬ÔòÁÐÖµµÄ×éºÏ±ØÐëΨһ¡£ËüÓÐÒÔϼ¸ÖÖ´´½¨·½Ê½£º
¡ñ     ´´½¨Ë÷Òý
CREATE UNIQUE INDEX indexName ON mytable(username(length))
¡ñ     Ð޸ıí½á¹¹
ALTER mytable ADD UNIQUE [indexName] ON (username(length))
¡ñ     ´´½¨±íµÄʱºòÖ±½ÓÖ¸¶¨
CREATE TABLE mytable(
ID INT NOT NULL,
username VARCHAR(16) NOT NULL,
UNIQUE [indexName] (username(length))
);
£¨3£©Ö÷¼üË÷Òý
ËüÊÇÒ»ÖÖÌØÊâµÄΨһË÷Òý£¬²»ÔÊÐíÓпÕÖµ¡£Ò»°ãÊÇÔÚ½¨±íµÄʱºòͬʱ´´½¨Ö÷¼üË÷Òý£º
CREATE TABLE mytable(
ID INT NOT NULL,
username VARCHAR(16) NOT NULL,
PRIMARY KEY(ID)
);
µ±È»Ò²¿ÉÒÔÓà ALTER ÃüÁî¡£¼Çס£ºÒ»¸ö±íÖ»ÄÜÓÐÒ»¸öÖ÷¼ü¡£
£¨4£©×éºÏË÷Òý
ΪÁËÐÎÏóµØ¶Ô±Èµ¥ÁÐË÷ÒýºÍ×éºÏË÷Òý£¬Îª±íÌí¼Ó¶à¸ö×ֶΣº
CREATE TABLE mytable(
ID IN


Ïà¹ØÎĵµ£º

perlÒ»¸ö¼òµ¥mysql²Ù×÷µÄС³ÌÐò

#!/usr/bin/perl
use Mysql;
print "Content-type:
text/html \n\n";
# MySQL
ÅäÖñäÁ¿
$host = "localhost";
$database
= "testdb";
$tablename = "testtable";
$user = "username";
$pw =
"password";
# PERL MYSQL CONNECT()
$connect = ......

MySQL Reference ManualÖÐÎÄ°æ

MySQL Reference Manual for version 4.1.0-alpha.
¡¡ÒëÕßÐò
¡¡ÁÐÀàÐÍÓ뺯ÊýË÷Òý
6 MySQL ÓïÑԲο¼

6.1 ÓïÑԽṹ

6.1.1 ÎÄ×Ö£ºÔõôд×Ö·û´®ÓëÊý×Ö

6.1.1.1 ×Ö·û´®

 
6.1.1.2 Êý×Ö

 
6.1.1.3 Ê®Áù½øÖÆÖµ
......

mysqlÐÔÄܵļì²éºÍµ÷ÓÅ·½·¨

ÎÒÒ»Ö±ÊÇʹÓÃmysqlÕâ¸öÊý¾Ý¿âÈí¼þ£¬Ëü¹¤×÷±È½ÏÎȶ¨£¬Ð§ÂÊÒ²ºÜ¸ß¡£ÔÚÓöµ½ÑÏÖØÐÔÄÜÎÊÌâʱ£¬Ò»°ã¶¼ÓÐÕâô¼¸ÖÖ¿ÉÄÜ£º
1¡¢Ë÷ÒýûÓн¨ºÃ£»
2¡¢sqlд·¨¹ýÓÚ¸´ÔÓ£»
3¡¢ÅäÖôíÎó£»
4¡¢»úÆ÷ʵÔÚ¸ººÉ²»ÁË£»
1¡¢Ë÷ÒýûÓн¨ºÃ
Èç¹û¿´µ½mysqlÏûºÄµÄcpuºÜ´ó£¬¿ÉÒÔÓÃmysqlµÄclient¹¤¾ßÀ´¼ì²é¡£
ÔÚlinuxÏÂÖ´ÐÐ
/usr/local/mysql/bin/ ......

jdbc Óë mysqlÁ¬½Ó

JDBCÁ¬½ÓMySQL
JDBCÁ¬½ÓMySQL
¼ÓÔؼ°×¢²áJDBCÇý¶¯³ÌÐò
Class.forName("com.mysql.jdbc.Driver");
Class.forName("com.mysql.jdbc.Driver").newInstance();
JDBC URL ¶¨ÒåÇý¶¯³ÌÐòÓëÊý¾ÝÔ´Ö®¼äµÄÁ¬½Ó
±ê×¼Óï·¨£º
<protocol£¨Ö÷ҪͨѶЭÒ飩>:<subprotocol£¨´ÎҪͨѶЭÒ飬¼´Çý¶¯³ÌÐòÃû³Æ£©>:<data so ......

mysqlÓÅ»¯£º ÄÚ´æ±íºÍÁÙʱ±í


mysqlÓÅ»¯£º ÄÚ´æ±íºÍÁÙʱ±í
2009Äê02ÔÂ01ÈÕ ÐÇÆÚÈÕ 10:41
ÓÉÓÚÖ±½ÓʹÓÃÁÙʱ±íÀ´´´½¨Öмä±í£¬ÆäËٶȲ»ÈçÈËÒ⣬Òò¶ø¾ÍÓÐÁË°ÑÁÙʱ±í½¨³ÉÄÚ´æ±íµÄÏë·¨¡£µ«ÄÚ´æ±íºÍÁÙʱ±íµÄÇø±ðÇÒ²¢²»ÊìϤ£¬ÐèÒª²éÕÒ×ÊÁÏÁË¡£
Ò»¿ªÊ¼ÒÔΪÁÙʱ±íÊÇ´´½¨ºó´æÔÚ£¬µ±Á¬½Ó¶Ï¿ªÊ±ÁÙʱ±í¾Í»á±»É¾³ý£¬¼´ÁÙʱ±íÊÇ´æÔÚÓÚ´ÅÅÌÉϵġ£¶øʵ¼Ê²Ù×÷Öз¢ÏÖÁÙÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ