mysqlµÄFIND_IN_SETº¯ÊýʹÓ÷½·¨
mysqlµÄ find_in_setº¯ÊýʹÓ÷½·¨
ºÜ¶àʱºòÎÒÃÇÔÚÉè¼ÆÊý¾Ý¿âʱÓÐÕâÖÖÇé¿ö,±ÈÈç:
ÓиöÎÄÕ±íÀïÃæÓиötype×Ö¶Î,Ëû´æ´¢µÄÊÇÎÄÕÂÀàÐÍ,ÓÐ 1Í·Ìõ,2ÍƼö,3Èȵã,4ͼÎÄ .....11,12,13µÈµÈ
ÏÖÔÚÓÐƪÎÄÕÂËû¼ÈÊÇ Í·Ìõ,ÓÖÊÇÈȵã,»¹ÊÇͼÎÄ,
typeÖÐÒÔ 1,3,4µÄ¸ñʽ´æ´¢.
ÄÇÃÇÎÒÃÇÈçºÎÓÃsql²éÕÒËùÓÐtypeÖÐÓÐ4ͼÎıê×¼µÄÎÄÕÂÄØ,
Õâ¾ÍÒªÎÒÃǵÄfind_in_set³öÂíµÄʱºòµ½ÁË.
ÏÈ¿´mysqlÊÖ²áÖÐfind_in_setº¯ÊýµÄÓï·¨:
FIND_IN_SET(str,strlist)
¼ÙÈç×Ö·û´®str ÔÚÓÉN ×ÓÁ´×é³ÉµÄ×Ö·û´®Áбístrlist ÖУ¬ Ôò·µ»ØÖµµÄ·¶Î§ÔÚ 1 µ½ N Ö®¼ä ¡£Ò»¸ö×Ö·û´®Áбí¾ÍÊÇÒ»¸öÓÉһЩ±»‘,’·ûºÅ·Ö¿ªµÄ×ÔÁ´×é³ÉµÄ×Ö·û´®¡£Èç¹ûµÚÒ»¸ö²ÎÊýÊÇÒ»¸ö³£Êý×Ö·û´®£¬¶øµÚ¶þ¸öÊÇtype SETÁУ¬Ôò FIND_IN_SET() º¯Êý±»ÓÅ»¯£¬Ê¹ÓñÈÌؼÆËã¡£Èç¹ûstr²»ÔÚstrlist »òstrlist Ϊ¿Õ×Ö·û´®£¬Ôò·µ»ØֵΪ 0 ¡£ÈçÈÎÒâÒ»¸ö²ÎÊýΪNULL£¬Ôò·µ»ØֵΪ NULL¡£ Õâ¸öº¯ÊýÔÚµÚÒ»¸ö²ÎÊý°üº¬Ò»¸ö¶ººÅ(‘,’)ʱ½«ÎÞ·¨Õý³£ÔËÐС£
mysql> SELECT FIND_IN_SET('b','a,b,c,d');
-> 2
ÓÃÆðÀ´ºÜ¼òµ¥
¾ÍÒÔÉÏÃæÎÒ˵µ½µÄÇé¿öÀ´¾ÙÀý:
ÒÔÏÂΪÒýÓõÄÄÚÈÝ£º
select * from article where FIND_IN_SET('4',type)
Ïà¹ØÎĵµ£º
ysqlĬÈÏÊDz»ÔÊÐíÔ¶³ÌÁ¬½ÓµÄ£¬ÒòΪÓкܴóµÄ°²È«Òþ»¼¡£
¡¡¡¡ÐèÒªÊÖ¶¯Ôö¼Ó¿ÉÒÔÔ¶³Ì·ÃÎÊÊý¾Ý¿âµÄÓû§¡£
¡¡¡¡·½·¨Ò»¡¢±¾µØµÇÈëmysql£¬¸ü¸Ä "mysql" Êý¾Ý¿âÀïµÄ "user" ±íÀïµÄ "host" Ï½«"localhost"¸ÄΪ"%"
#mysql -u root -proot
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
my ......
Link from : http://www.5ilinux.com/blog/archives/000091.html
1.Ê×ÏÈÎÒÃǽ¨Á¢ÏàÓ¦µÄÓû§ºÍÓû§×é
groupadd -g 5500 ftpgroup
adduser -u 5500 -s /bin/false -d /bin/null -c "proftpd user" -g ftpgroup ftpuser
2.²Ù×÷Êý¾Ý¿â
mysql mysql -uroot -ppassword
create database ftpdb
grant select, upd ......
MySQL Á·Ï°ÊÖ¸å
MySQL ½éÉÜ
MySQL ABÊÇÓÉMySQL´´Ê¼È˺ÍÖ÷Òª¿ª·¢ÈË´´°ìµÄ¹«Ë¾¡£MySQL AB×î³õÊÇÓÉDavid Axmark¡¢Allan
LarssonºÍMichael“Monty
”WideniusÔÚÈðµä´´°ìµÄ¡£
¹«Ë¾ÃûÖеēAB”ÊÇÈðµäÓ ......
¸ømysql¿ªÒ»¸ö¿ÉÒÔÔ¶³Ì·ÃÎʵÄÓû§ÃüÁîÈçÏÂ:
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
"*.*" ±íʾÊý¾Ý¿âÖÐËùÓеıí,Ò²¿ÉÒÔ»»³ÉÖ¸¶¨µÄ±íÈçtest.*
"myuser" ±íʾµÄÊÇ·ÃÎʵÄÓû§Ãû;
"%" ±íʾËùÓеÄÖ÷»ú¼´ÈκεÄÖ÷»ú¶¼¿ÉÒÔͨ¹ýÕâ¸öÓû§Ãû·ÃÎÊÎÒµÄÊý¾Ý¿â,Ò²¿ÉÒԸóÉÌض¨µ ......