There is no "mass revoke" statement so you best option to change this is to update the users table:
UPDATE mysql.user SET Grant_priv = 'N' WHERE user != 'root';
Not that occasionally, there are users that should have grant privileges (and should have that) which are not named root
. On my system, for example, I have debian-sys-maint
(which I actually wonder if they should have grant privileges, but that's how it's installed).
Do not forget to reload the privileges after changing the user table:
FLUSH PRIVILEGES;
You can find more information on http://dev.mysql.com/doc/refman/5.5/en/privilege-changes.html.
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
To be able to create mysql users, you need to be able to insert into the users table in the mysql database. So create your master user and give him write access to the mysql database.
The documentation states ( http://dev.mysql.com/doc/refman/5.7/en/create-user.html )
So the process would be something like this:
Also, it is deemed good practice to use a test system to test such behaviour; so that when you mess up, there is no harm done to a actual real database.