Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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
ÃüÁî¡£¼Çס£ºÒ»¸ö±íÖ»ÄÜÓÐÒ»¸


Ïà¹ØÎĵµ£º

mysql »ù±¾ÃüÁî

1¡¢µÇ½MySQL:
mysql -u root -p
2¡¢²é¿´Óû§ÐÅÏ¢
select user,host,password from mysql.user;
select user,host from mysql.user;
3¡¢ÉèÖÃÃÜÂë
set password for root@localhost=password('
ÔÚÕâÀïÌîÈërootÃÜÂë
');
4¡¢ÐÞ¸ÄÃÜÂë
·½·¨1£ºmysqladmin -u root -p password newpassword
·½·¨2£º ££mysql -u root ......

MySQL Master/Slave Server ¼ÜÉè



»·¾³£ºÁ½Ì¨·þÎñÆ÷IP:192.168.30.57\192.168.30.58
1¡¢ÏÂÔØmysql-5.0.86-linux-i686-glibc23.tar.gz µ½http://dev.mysql.com/downloads/mysql/5.0.html#linuxÏÂÔØ
2¡¢½âѹ tar -zxvf
mysql-5.0.86-linux-i686-glibc23.tar.gz
3¡¢´´½¨Á´½Ó ln -s
mysql-5.0.86-linux-i686-g ......

mysqlÃÜÂëÍü¼ÇµÄÐ޸ķ½·¨

1¡¢ÔÚlinuxÏ£º
     ²é¿´mysql ÊÇ·ñÔËÐУºps -ef | grep myslq
     Èç¹û MySQL ÕýÔÚÔËÐУ¬Ê×ÏÈɱ֮: kill mysqlµÄ½ø³ÌºÅ¡£
¡¡¡¡Æô¶¯ MySQL :/usr/bin/safe_mysqld --skip-grant-tables &
¡¡¡¡¾Í¿ÉÒÔ²»ÐèÒªÃÜÂë¾Í½øÈë MySQL ÁË¡£
¡¡¡¡È»ºó¾ÍÊÇ
¡¡¡¡>use mysql
¡¡¡¡ ......

.net·ÃÎÊMysqlһЩϸ½ÚÎÊÌâ

²ÉÓõÄÊÇMySql¹Ù·½ÌṩµÄ.NET connector£¬´ËÇý¶¯Ö»ÐèÒªÏÂÔؼ´¿ÉʹÓãºhttp://dev.mysql.com/downloads/connector/net/1.0.html
   ÔÚʹÓÃÖлýÀÛÁ˼¸µã¾­Ñ飺
    1)ʹÓÃParameter²ÎÊýÐÎʽÌá½»Commandʱ±ØÐëÒª°Ñ"@"ºÅ»»³É"?"ºÅ£¬ÕâÒ»µãÈÃÎÒÀ§»óÁËÒ»Ì죬ֻÊDz»Ã÷°×MySQLΪºÎÒª¸ãÌØÊâÄØ£¬ÏóMS¡¢ODP.NE ......

ÕýÈ·Àí½âMysqlµÄÁÐË÷ÒýºÍ¶àÁÐË÷Òý

  MysqlÊý¾Ý¿âÌṩÁ½ÖÖÀàÐ͵ÄË÷Òý£¬Èç¹ûûÕýÈ·ÉèÖã¬Ë÷ÒýµÄÀûÓÃЧÂÊ»á´ó´òÕÛ¿ÛÈ´ÍêÈ«²»ÖªÎÊÌâ³öÔÚÕâ¡£
CREATE TABLE test (
id INT NOT NULL,
last_name CHAR(30) NOT NULL,
first_name CHAR(30) NOT NULL,
PRIMARY KEY (id),
INDEX name (last_name,first_name)
);
ÒÔÉÏ´ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ