I have a database on a remote server called qrtest_db and thru putty I have connected in and given all privileges to it. In my C# application I can access it just fine for normal day to day stuff, updating, inserting deleting etc.
And when I do SHOW GRANTS I get back the following…
GRANT ALL PRIVILEGES ON *.* TO 'root'@'myIpAddress' IDENTIFIED BY PASSWORD 'myPasswordencrypted'
GRANT ALL PRIVILEGES ON `qrtest_db`.* TO 'root'@'myIpAddress'
But if I try to run a GRANT statement in C# like as follows . . .
"GRANT USAGE ON qrtest_db.* to 'root'@'" + someIPAddress + "' IDENTIFIED BY 'myPassword'";
then on the cmd.ExecuteNonQuery I get the message back. . .
Access denied for user ‘root’@’myIPAddress’ to database ‘qrtest_db’
Does anybody have any ideas as to why this is this happening?
Is grant not allowed remotely thru the .Net connector?
I can sit at the console and grant rights all day long.
You dont have
GRANTprivilege.Becasue
ALL PRIVILEGESdoes not containGRANTprivilege. ReferenceYou created a
'root'@'myIpAddress'user withall privileges. It does not contain GRANT. Then you used this newly created user ('root'@'myIpAddress') to connect to db server. Your C# application is using'root'@'myIpAddress'user to connect to the db server. When you enterGRANTcommand through C#, it fails. Because this user('root'@'myIpAddress') dont have GRANT option. You didn’t created it that way.You should have created user with these statements (
WITH GRANT OPTIONappended)