The fundamental problem you have is this:
You cannot grant another user a privilege which you yourself do not have; the GRANT OPTION
privilege enables you to assign only those privileges which you yourself possess.
— http://dev.mysql.com/doc/refman/5.6/en/grant.html
This makes sense, since if it were otherwise, then you could just grant privileges to yourself.
There is one way around this, depending on how much flexibility you have with the calling code -- stored procedures can run with the credentials of the defining user (as opposed to the invoking user). If the calling system could call a procedure instead of using GRANT ...
, then you can create a procedure that is executable by the restricted user, granting other privileges as appropriate.
I have discussed situations like this before in these posts:
In your case do this
STEP #1
Add these lines just under the [mysqld]
group header in my.ini
[mysqld]
skip-grant-tables
skip-networking
STEP 2
Open Windows Command Line as Administrator, and reboot MySQL Service
C:\> net stop mysql
C:\> net start mysql
STEP 3
You can login to MySQL
C:\> mysql <Hit Enter>
STEP 4
From the mysql prompt, run this
SET @PasswordHash = PASSWORD('whateverpasswordiwant');
REPLACE INTO mysql.user SET
Host = 'root',
User = 'localhost',
Password = @PasswordHash,
Select_priv = 'Y',
Insert_priv = 'Y',
Update_priv = 'Y',
Delete_priv = 'Y',
Create_priv = 'Y',
Drop_priv = 'Y',
Reload_priv = 'Y',
Shutdown_priv = 'Y',
Process_priv = 'Y',
File_priv = 'Y',
Grant_priv = 'Y',
References_priv = 'Y',
Index_priv = 'Y',
Alter_priv = 'Y',
Show_db_priv = 'Y',
Super_priv = 'Y',
Create_tmp_table_priv = 'Y',
Lock_tables_priv = 'Y',
Execute_priv = 'Y',
Repl_slave_priv = 'Y',
Repl_client_priv = 'Y',
Create_view_priv = 'Y',
Show_view_priv = 'Y',
Create_routine_priv = 'Y',
Alter_routine_priv = 'Y',
Create_user_priv = 'Y',
Event_priv = 'Y',
Trigger_priv = 'Y',
Create_tablespace_priv = 'Y',
ssl_type = '',
ssl_cipher = '',
x509_issuer = '',
x509_subject = '',
max_questions = 0,
max_updates = 0,
max_connections = 0,
max_user_connections = 0
;
REPLACE INTO mysql.user SET
Host = 'root',
User = '127.0.0.1',
Password = @PasswordHash,
Select_priv = 'Y',
Insert_priv = 'Y',
Update_priv = 'Y',
Delete_priv = 'Y',
Create_priv = 'Y',
Drop_priv = 'Y',
Reload_priv = 'Y',
Shutdown_priv = 'Y',
Process_priv = 'Y',
File_priv = 'Y',
Grant_priv = 'Y',
References_priv = 'Y',
Index_priv = 'Y',
Alter_priv = 'Y',
Show_db_priv = 'Y',
Super_priv = 'Y',
Create_tmp_table_priv = 'Y',
Lock_tables_priv = 'Y',
Execute_priv = 'Y',
Repl_slave_priv = 'Y',
Repl_client_priv = 'Y',
Create_view_priv = 'Y',
Show_view_priv = 'Y',
Create_routine_priv = 'Y',
Alter_routine_priv = 'Y',
Create_user_priv = 'Y',
Event_priv = 'Y',
Trigger_priv = 'Y',
Create_tablespace_priv = 'Y',
ssl_type = '',
ssl_cipher = '',
x509_issuer = '',
x509_subject = '',
max_questions = 0,
max_updates = 0,
max_connections = 0,
max_user_connections = 0
;
exit
STEP 5
Remove skip-grant-tables
and skip-networking
from my.ini
STEP 6
Restart MySQL
C:\> net stop mysql
C:\> net start mysql
STEP 7
Try logging into MySQL
GIVE IT A TRY !!!
Best Answer
WOW that's a very old version of MySQL.
Here is mysql.user from version 4.1.20:
Since we are talking Windows, there should be a service called MySQL or some other name pointing to C:\Program Files\MySQL. If that's not the folder, search the entire disk for my.ini. Once you found my.ini, here is a sure fire way to insert a new user called 'oracleclient':
Step 01) Shutdown Application
Step 02) net stop mysql
Step 03) Add skip-grant-tables to my.ini
Step 04) net start mysql
Step 05) run 'mysql' at the DOS prompt (no password needed)
Step 06) From mysql prompt, run this INSERT statement
Step 07) exit mysql
Step 08) net stop mysql
Step 09) net start mysql (close your eyes and hit enter)
Step 10) See if everything works !!!
You should be able to connect from the oracle server.
BUT WAIT !!!
What if there is no my.ini and the application has the setting only ???
Here is something a little more daring:
Step 01) Install the same version (MySQL 4.1.18) onto another PC (Server2)
Using the wizard, this should place the MySQL binaries: C:\Program Files\MySQL\MySQL 4.1. This would be considered the basedir. The subfolder data\mysql would be the home of the mysql schema.
Step 02) Create my.ini in basedir of Server2
Step 03) Copy user.frm, user.MYI, user.MYD from the mysql schema of Server1 into the same place in Server2
Step 04) Perform Steps 3-8 from the first plan
Step 05) Make sure you have a backup copy of the mysql schema of Server1
Step 06) Copy user.frm, user.MYI, user.MYD from the mysql schema of Server2 into the same place in Server1
Step 07) net start mysql on Server1 and the application (close your eyes and hit enter)
Step 08) See if everything works !!!
Give it a Try !!!