I am trying to remotely to change permissions of my database user in MySQL.
Issue occur when I try to Grant permissions to my database user in PHPMyAdmin.
when i execute this line:
GRANT ALL PRIVILEGES ON *.* TO root#"%" IDENTIFIED BY 'rootPass';
Error Occur: Access Denied to User _____ # 'localhost' (using Password: Yes)
Kindly Help Me.
Thanks in Advance
Have you tried to run FLUSH PRIVILEGES; after you executed that line?
Sample:
GRANT ALL PRIVILEGES ON *.* TO root#"%" IDENTIFIED BY 'rootPass';
FLUSH PRIVILEGES;
The user you're logged in as to execute that statement doesn't have "with grant option" privileges. That could be the root user or another privileged user.
Related
I have been trying to access the remote MySql database server in C# Entity framework but end in following error
{"Access denied for user 'test'#'%' to database 'test'"}
My connection string is server='192.168.0.1';uid=test;database=test;password=1234
However if i access the database through workbench it allows me to access the server and inserting and deleting the data in tables.
What causing the error ?
Execute below statement to grant access on test-
GRANT all privileges on test.* to test#'%' identified by '1234';
Note: You can change all privileges with your specific permissions.
You can also assign rights on all databases by-
GRANT all privileges on *.* to test#'%' identified by '1234';
Note: Best way is that rights should provide only to specific ip and limited rights as per requirement.
I try installing my Windows service using InstallUtil.exe and running my command prompt as Administrator.
InstalUtil.exe WindowsService.exe /ShowCallStack
The above command opens a 'Set Service Login' window, see the picture at this link.
When I enter 'Jasper Catthoor' in the username field (my account name) and my windows password in the password fields, I get the following error:
System.ComponentModel.Win32Exception: The trust relationship between the primary domain and the trusted domain failed.
When I enter as username 'jasper#catthoor.com' (email of my account, see previous picture), I get the following error:
System.ComponentModel.Win32Exception: The specified domain either does not exist or could not be contacted.
By entering a random username I receive the same error as when I enter 'Jasper Catthoor'.
By entering a random email (with an # sign), I receive the error:
System.ComponentModel.Win32Exception: No mapping between account names and security IDs was carried out.
Try taking your machine out of the domain and then re-add into the domain. Post that re-start your machine.
Also in your ProjectInstaller.cs file set the Account as LocalSystem.
It should work. Hope this helps.
Regards,
Abhinaw
Does the service really require to run under your user account? You could also try to use the Local Service account which most of the service run under.
You can also try to set the account information in the Account property of the ServiceProcessInstaller.
I wrote a simple c# code that connect to sql-server database and execute a query:
cmd = new SqlCommand(txtQuery.Text.ToString().Trim(), con);
cmd.ExecuteNonQuery();
in my db I have a table named myTB. I have two users too: user1(owner), user2(new user created)
I logged in (connected to DB) with user2's username and password !
I can access the tables that created by user1 with the query bellow:
"select * from user1.myTB"
(I don't know why I get error with this query:"select * from myTB", forget it now!)
Now I wanna REVOKE 'select' permission from user2. I mean I don't want user2 to execute the select query on myTB table which is created by user1.
what should I do is a problem that I'm stuck on it !
I used this query, but nothing changed !
Q1: "Revoke select ON user1.myTB FROM user2"
again user2 can do select * from user1.myTB !!! WHY !?
please help me with this.
thanks.
user2 is probably getting it's permissions from a role membership.
Run:
use [<YourDatabase>]
GO
exec sp_helpuser
find the user in the first column, and then look at the second column. Is the user a member of db_datareader or db_owner?
If so, you can revoke membership, say for db_datareader, by doing:
exec sp_droprolemember 'db_datareader', 'user2'
GO
You cannot REVOKE something you did not GRANT. Looks like you want to:
investigate and understand why user2 has permission to SELECT
possibly DENY permission to SELECT to user2
The permission work like following:
initialy an user has the poermissions derived from his group mebership (including public roles)
GRANT explictly grants a privilege
REVOKE takes back a previously granted priviledge, reverting to the user having the privileges implictily inherited from group(s) memberhip
DENY denies a privilege
The rules of precedence are that any DENY take precedence over any GRANT or inherited privilege. One can get access through a number of GRANTs but one single DENY will revoke the privilege. You cannot GRANT/REVOKE/DENY permissions to the securable owner (members of db_owner own everything and members of sysadmin own everything on the entire server).
Thanks friends,
I've solved it and use DENY instead of REVOKE :
DENY select ON user1.myTB TO user2
EDIT: I reinstalled MySQL and this fixed itself. No idea what the issue was.
I ran the following commands in MySQL from the command line:
1. REVOKE ALL PRIVILEGES ON MyDB.* FROM user#'%';
2. DROP USER user#'%";
3. GRANT INSERT,SELECT,DELETE,UPDATE ON MyDB.* TO user#'%' IDENTIFIED BY 'somepassword';
4. FLUSH PRIVILEGES;
The grants for the user are:
GRANT USAGE ON . to 'user'#'%' IDENTIFIED BY PASSWORD
GRANT SELECT,INSERT,UPDATE,DELETE ON 'MyDB'.* TO 'user'#'%'
But then I get the following error message when I try to do an update.
UPDATE command denied to user 'user'#'somehost' for table 'sometable'
Relevant info:
SELECT,INSERT, and DELETE all work properly.
I am using C# with Connector/NET
'somehost' is on the same network as the server (different computer).
'sometable' is in MyDB.
If I log in to the server with 'user' on the host machine, update queries work just fine.
EDIT:
If I grant UPDATE,SELECT,INSERT,DELETE to user#'somehost.net', UPDATE queries work without a problem.
Any ideas?
After taking away all the grants, first you should give the usage privilege to the user.
GRANT USAGE on MyDB.* to 'user'#'localhost'
Usage privilege tells the server that this user is allowed to use MySQL
Reinstalling fixed the issue. Not sure what the problem was.
While i am deploying my solution in to sharepoint, it is showing:
"Inner exception(1): The EXECUTE
permission was denied on the object
'proc_putObject', database
'SharePoint_Config', schema 'dbo'".
Unable to deploy the solution.
Can any one give the solution....
Thank you.
To deploy an SharePoint solution (wsp) write access to the SharePoint Config database is required. You have to ensure that the executing user is a Farm Administrator.
I do not recommend changing the permissions on the DB manually as suggested by "System.Exception" since this is not supported by Microsoft.
As Share point uses the SQL Server as backend, I added my login id with admin permissions in SQL server. It is working fine.
Try to activate the feature using the stsadm command
stsadm -o activatefeature -name thisfeaturename> -url http://thisserver/
The login you are using to execute the sproc proc_putObject doesn't has permission to execute the sproc! For your login grant execute permission on this sproc!