限制普通用户在huago_production_tool数据库上的权限
This commit is contained in:
parent
c6a0a02c10
commit
4f568b20ab
|
@ -312,7 +312,7 @@ HGResult HGPdtToolDbUserMgrImpl::CreateUser(const HGChar* userName, const HGChar
|
||||||
return HGBASE_ERR_FAIL;
|
return HGBASE_ERR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(sqlCmd, "grant all privileges on huago_production_tool.* to '%s'@'%%';", userName);
|
sprintf(sqlCmd, "grant create, insert, select, update on huago_production_tool.* to '%s'@'%%';", userName);
|
||||||
ret = mysql_query(m_sql, sqlCmd);
|
ret = mysql_query(m_sql, sqlCmd);
|
||||||
assert(0 == ret);
|
assert(0 == ret);
|
||||||
sprintf(sqlCmd, "grant select on mysql.user to '%s'@'%%';", userName);
|
sprintf(sqlCmd, "grant select on mysql.user to '%s'@'%%';", userName);
|
||||||
|
|
|
@ -5,17 +5,17 @@
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
HGPdtToolDbUserMgr userMgr = NULL;
|
HGPdtToolDbUserMgr userMgr = NULL;
|
||||||
HGPdtToolDb_CreateUserMgr("127.0.0.1", 3306, "huago", "123456", &userMgr);
|
HGPdtToolDb_CreateUserMgr("127.0.0.1", 3306, "root", "123456", &userMgr);
|
||||||
if (NULL != userMgr)
|
if (NULL != userMgr)
|
||||||
{
|
{
|
||||||
HGChar* name[256];
|
HGChar* name[256];
|
||||||
HGUInt count;
|
HGUInt count;
|
||||||
HGPdtToolDb_GetUserList(userMgr, name, 256, &count);
|
HGPdtToolDb_GetUserList(userMgr, name, 256, &count);
|
||||||
|
|
||||||
//HGPdtToolDb_DestroyUser(userMgr, "huago");
|
HGPdtToolDb_DestroyUser(userMgr, "huago");
|
||||||
|
|
||||||
//HGPdtToolDb_CreateUser(userMgr, "huago", "123456");
|
HGPdtToolDb_CreateUser(userMgr, "huago", "123456");
|
||||||
HGPdtToolDb_ModifyPassword(userMgr, "123456", "huago");
|
//HGPdtToolDb_ModifyPassword(userMgr, "123456", "huago");
|
||||||
//HGPdtToolDb_SetPassword(userMgr, "huago", "qqq");
|
//HGPdtToolDb_SetPassword(userMgr, "huago", "qqq");
|
||||||
|
|
||||||
HGPdtToolDbDevice device = NULL;
|
HGPdtToolDbDevice device = NULL;
|
||||||
|
|
Loading…
Reference in New Issue