MYSQLÓû§È¨ÏÞ¹ÜÀí(Grant,Revoke)
MySQL¿ÉÒÔΪ²»Í¬µÄÓû§·ÖÅäÑϸñµÄ¡¢¸´ÔÓµÄȨÏÞ¡£ÕâЩ²Ù×÷´ó¶à¶¼¿ÉÒÔÓÃSQLÖ¸ÁîGrant£¨·ÖÅäȨÏÞ£©ºÍRevoke£¨»ØÊÕȨÏÞ£©À´ÊµÏÖ¡£ Grant¿ÉÒÔ°ÑÖ¸¶¨µÄȨÏÞ·ÖÅä¸øÌض¨µÄÓû§£¬Èç¹ûÕâ¸öÓû§²»´æÔÚ£¬Ôò»á´´½¨Ò»¸öÓû§¡£
Grant ³£Óøñʽ:
grant ȨÏÞ1,ȨÏÞ2,…ȨÏÞn on Êý¾Ý¿âÃû³Æ.±íÃû³Æ to Óû§Ãû@Óû§µØÖ· identified by ‘Á¬½Ó¿ÚÁî’;
ȨÏÞ1,ȨÏÞ2,…ȨÏÞn´ú±íselect,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,fileµÈ14¸öȨÏÞ¡£
µ±È¨ÏÞ1,ȨÏÞ2,…ȨÏÞn±»all privileges»òÕßall´úÌ棬±íʾ¸³ÓèÓû§È«²¿È¨ÏÞ¡£
µ±Êý¾Ý¿âÃû³Æ.±íÃû³Æ±»*.*´úÌ棬±íʾ¸³ÓèÓû§²Ù×÷·þÎñÆ÷ÉÏËùÓÐÊý¾Ý¿âËùÓбíµÄȨÏÞ¡£
Óû§µØÖ·¿ÉÒÔÊÇlocalhost£¬Ò²¿ÉÒÔÊÇipµØÖ·¡¢»úÆ÷Ãû×Ö¡¢ÓòÃû¡£Ò²¿ÉÒÔÓÃ’%'±íʾ´ÓÈκεØÖ·Á¬½Ó¡£
‘Á¬½Ó¿ÚÁî’²»ÄÜΪ¿Õ£¬·ñÔò´´½¨Ê§°Ü¡£
±È½ÏÖØÒªµÄÊÇpriveleges£¨È¨ÏÞ£©¡£
ÆÕͨÓû§µÄȨÏÞȨÏÞÓ¦ÓÃÓÚÃèÊö
SELECT±í£¬ÁÐÔÊÐíÓû§´Ó±íÖÐÑ¡ÔñÐУ¨¼Ç¼£©
INSERT±í£¬ÁÐÔÊÐíÓû§ÔÚ±íÖвåÈëÐÂÐÐ
UPDATE±í£¬ÁÐÔÊÐíÓû§ÐÞ¸ÄÏÖ´æ±íÀïÐÐÖеÄÖµ
DELETE±íÔÊÐíÓû§É¾³ýÏÖ´æ±íµÄÐÐ
INDEX±íÔÊÐíÓû§´´½¨ºÍÍ϶¯Ìض¨±íË÷Òý
ALTER±íÔÊÐíÓû§¸Ä±äÏÖ´æ±íµÄ½á¹¹¡£ÀýÈ磬¿ÉÌí¼ÓÁС¢ÖØÃüÃûÁлò±í¡¢ÐÞ¸ÄÁеÄÊý¾ÝÀàÐÍ
CREATEÊý¾Ý¿â£¬±íÔÊÐíÓû§´´½¨ÐÂÊý¾Ý¿â»ò±í¡£Èç¹ûÔÚGRANTÖÐÖ¸¶¨ÁËÒ»¸öÌض¨µÄÊý¾Ý¿â»ò±í£¬ËûÃÇÖ»Äܹ»´´½¨¸ÃÊý¾Ý¿â»ò±í£¬¼´ËûÃDZØÐëÊ×ÏÈɾ³ý£¨Drop£©Ëü
DROPÊý¾Ý¿â£¬±íÔÊÐíÓû§Í϶¯£¨É¾³ý£©Êý¾Ý¿â»ò±í
¹ÜÀíԱȨÏÞȨÏÞÃèÊö
CREATE TEMPORARY TABLESÔÊÐí¹ÜÀíÔ±ÔÚCREATE TABLEÓï¾äÖÐʹÓÃTEMPORARY¹Ø¼ü×Ö
FILEÔÊÐí½«Êý¾Ý´ÓÎļþ¶ÁÈë±í£¬»ò´Ó±í¶ÁÈëÎļþ
LOCK TABLESÔÊÐíʹÓÃLOCK TABLESÓï¾ä
PROCESSÔÊÐí¹ÜÀíÔ±²é¿´ÊôÓÚËùÓÐÓû§µÄ·þÎñÆ÷½ø³Ì
RELOADÔÊÐí¹ÜÀíÔ±ÖØÐÂÔØÈëÊÚȨ±í¡¢Çå¿ÕÊÚȨ¡¢Ö÷»ú¡¢ÈÕÖ¾ºÍ±í¸ñ
REPLICATION CLIENTÔÊÐíÔÚ¸´ÖÆÖ÷»ú£¨Master£©ºÍ´Ó»ú£¨Slave£©ÉÏʹÓÃSHOW STATUS
REPLICATION SLAVEÔÊÐí¸´ÖÆ´Ó·þÎñÆ÷Á¬½Óµ½Ö÷·þÎñÆ÷
SHOW DATABASESÔÊÐíʹÓÃSHOW DATABASESÓï¾ä²é¿´ËùÓеÄÊý¾Ý¿âÁÐ±í¡£Ã»ÓÐÕâ¸öȨÏÞ£¬Óû§Ö»ÄÜ¿´µ½ËûÃÇÄܹ»¿´µ½µÄÊý¾Ý¿â
SHUTDOWNÔÊÐí¹ÜÀíÔ±¹Ø±ÕMySQL·þÎñÆ÷
SUPERÔÊÐí¹ÜÀíÔ±¹Ø±ÕÊôÓÚÈκÎÓû§µÄÏß³Ì
ÌرðµÄȨÏÞȨÏÞÃèÊö
ALL£¨»òALL P
Ïà¹ØÎĵµ£º
´úÂëÈçÏÂ:
//Á´½ÓʱÉ趨
mysql_real_connect( ..., CLIENT_MULTI_STATEMENTS );
//»òÕß
//ÖÐ;ָ¶¨
mysql_set_server_option( mysql, MYSQL_OPTION_MULTI_STATEMENTS_ON ); //mysqlÊÇÁ¬½ÓµÄÃû³Æ
µ±Ê¹ÓÃÖ´ÐжàÓï¾ä¹¦Äܺó£¬Ò»¶¨Òª¶ÁÍêÕû¸öresault¼¯£¬·ñÔò»á³öÏÖ´íÎó£ºCommands out of sync; you can't run this co ......
1
Ë÷ÒýµÄÒâÒ壺
Óŵ㣺
Ë÷ÒýÓÃÀ´¿ìËÙµØÑ°ÕÒÄÇЩ¾ßÓÐÌض¨ÖµµÄ¼Ç¼£¬Èç¹ûûÓÐË÷Òý£¬Ö´Ðвéѯʱ±ØÐë´ÓµÚÒ»¸ö¼Ç¼¿ªÊ¼É¨Ãè±íÖÐËùÓмǼ£¬±íÀïÃæµÄ¼Ç¼ÊýÁ¿Ô½¶à£¬Õâ¸ö²Ù×÷µÄ´ú¼Û¾ÍÔ½¸ß¡£
ȱµã£º
Ë÷ÒýÒªÕ¼ÓôÅÅ̿ռ䣻ÇÒÈκÎд²Ù×÷Éæ¼°µÄË÷Òý¸öÊý¶àµÄ»°»áÒýÆð½µËÙ£¬ÒòΪ
MySQL
²»½öÒª°Ñ¸Ä¶¯Êý¾ ......
жÔØmysql
1¡¢²éÕÒÒÔÇ°ÊÇ·ñ×°ÓÐmysql
ÃüÁrpm -qa|grep -i mysql
¿ÉÒÔ¿´µ½mysqlµÄÁ½¸ö°ü£º
mysql-4.1.12-3.RHEL4.1
mysqlclient10-3.23.58-4.RHEL4.1
2¡¢É¾³ýmysql
ɾ³ýÃüÁrpm -e --nodeps °üÃû
( rpm -ev mysql-4.1.12-3.RHEL4.1 )
3¡¢É¾³ýÀÏ°æ±¾mysqlµÄ¿ª·¢Í·ÎļþºÍ¿â
ÃüÁrm -fr /usr/lib/mysql
r ......
Ò»¹²ÓÐÈý¸öÀࣺWriteFile ; ReadFile ; InsertDB ;
//WriteFile.java
//ÓÃÓÚ½«ÐÅϢдÈëÎı¾Îļþ
package org.mb.insertfromfile;
import java.io.*;
public class WriteFile{
private int count = 0 ;
public int getCount() {
return count;
}
public void setCount(int count) {
this.cou ......
¾Ý¹úÍâýÌ屨µÀ£¬MySQLÊý¾Ý¿âµÄ¿ª·¢ÕßMichael WideniusÒÔ¼°²¿·ÖÏà¹ØÈËÊ¿½üÈÕÏòÅ·ÖÞ¡¢ÖйúÓë¶íÂÞ˹µÄ¼à¹Ü»ú¹¹Ìá½»Á˶Լ׹ÇÎÄ-Sun½»Ò׵ķ´¶ÔÒâ¼û£¬ÓдóÔ¼14000ÈËÔÚ¸ÃÒâ¼ûÉÏÇ©×Ö±íʾËûÃǶԴËÊÕ¹ºµÄ·´¶Ô¡£Å·ÃËίԱ»á´ËÇ°Ôø·´¶Ô¼×¹ÇÎÄÊÕ¹ºSun£¬µ«Õâһ¢¶ÏÉó²é»ú¹¹ÔÚ12ÔÂÓֳƣ¬¶Ô´Ë½»Ò×´ï³ÉÒ»¸öÂúÒâµÄ½á¹û±íʾÀÖ¹Û¡£Å·ÃËίԱ»á½«Ô ......