mysqlÖÐuserÊÇʲôÒâ˼
mysql ÖÐµÄ user ÊÇÒ»¸öÊý¾Ý¿â¹¤¾ß£¬ËüÌåÏÖ¿ÉÒÔÓëÊý¾Ý¿â½»»¥µÄʵÌ壬°üÀ¨Óû§Ãû¡¢ÃÜÂ롢ȨÏÞºÍÖ÷»úÐÅÏ¢¡£Í¨¹ý create user ¿É½¨ÉèÓû§£¬grant ÊÚÓèȨÏÞ£¬revoke ×÷·ÏȨÏÞ¡£ÖÎÀí user ¹ØÓÚÊý¾Ý¿âÇå¾²ÖÁ¹ØÖ÷Òª£¬ÓÉÓÚËü¿ØÖÆ»á¼ûȨÏ޺ͲÙ×÷¡£
MySQL ÖÐµÄ User
ʲôÊÇ User£¿
MySQL ÖÐµÄ User ÊÇÒ»¸öÊý¾Ý¿â¹¤¾ß£¬ËüÌåÏÖÒ»¸ö¿ÉÒÔÓë¸ÃÊý¾Ý¿â¾ÙÐн»»¥µÄʵÌå¡£Ëü½ç˵ÁËÓû§¶ÔÊý¾Ý¿â¼°Æ乤¾ßµÄ»á¼ûȨÏÞ¡£
User µÄ×é³É£º
Ò»¸ö User ͨ³£°üÀ¨ÒÔÏÂÐÅÏ¢£º
Óû§Ãû (user_name)£º Óû§±êʶ·û£¬ÔÚÊý¾Ý¿âÖÐΨһ¡£
ÃÜÂë (password)£º ÓÃÓÚÑéÖ¤Óû§Éí·ÝµÄ¼ÓÃÜ×Ö·û´®¡£
ȨÏÞ (privileges)£º ÊÚÓèÓû§»á¼ûºÍ²Ù×÷Êý¾Ý¿âÌض¨¹¤¾ß£¨ÀýÈç±í¡¢ÊÓͼ¡¢Àú³Ì£©µÄȨÏÞ¡£
Ö÷»ú (host)£º ÔÊÐíÓû§´ÓÖÐÅþÁ¬µ½Êý¾Ý¿âµÄÖ÷»ú»ò IP µØµã¡£
½¨Éè User£º
¿ÉÒÔʹÓà CREATE USER Óï¾ä½¨ÉèÐ嵀 User£º
CREATE USER 'username' IDENTIFIED BY 'password';
µÇ¼ºó¸´ÖÆ
ÊÚÓèȨÏÞ£º
¿ÉÒÔʹÓà GRANT Óï¾äÊÚÓèÓû§È¨ÏÞ£º
GRANT SELECT ON database.table TO 'username';
µÇ¼ºó¸´ÖÆ
×÷·ÏȨÏÞ£º
¿ÉÒÔʹÓà REVOKE Óï¾ä×÷·ÏÓû§È¨ÏÞ£º
REVOKE SELECT ON database.table FROM 'username';
µÇ¼ºó¸´ÖÆ
ÖÎÀí User£º
ÒÔÏÂÊÇһЩÖÎÀí User µÄÓÐÓÃÏÂÁ
SHOW GRANTS FOR ‘username’;£ºÏÔʾÓû§µÄȨÏÞ¡£
ALTER USER ‘username’ IDENTIFIED BY ‘new_password’;£º¸ü¸ÄÓû§µÄÃÜÂë¡£
DROP USER ‘username’;£ºÉ¾³ýÓû§¡£
User µÄÖ÷ÒªÐÔ£º
ÖÎÀí User ºÜÊÇÖ÷Òª£¬ÓÉÓÚËüʹÖÎÀíÔ±Äܹ»¿ØÖÆË¿ÉÒÔ»á¼ûÊý¾Ý¿âÒÔ¼°ËûÃÇ¿ÉÒÔÖ´ÐÐÄÄЩ²Ù×÷¡£ÕâÓÐÖúÓÚ±£»¤Êý¾Ý¿âÊý¾ÝµÄÇå¾²ÐÔ£¬±ÜÃâδ¾ÊÚȨµÄ»á¼ûºÍÐ޸ġ£
ÒÔÉϾÍÊÇmysqlÖÐuserÊÇʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡