1

When I log in with user root on localhost using MySQL WorkBench and click on Users and Privileges, I get the message 'The account you are currently using does not have sufficient privileges to make changes to MySQL users and privileges'.

Following the procedure in this answer I am able to restore my root user’s full privileges:

  • Stop mysqld and restart it with the --skip-grant-tables option.
  • Connect to the mysqld server with just: mysql (i.e. no -p option, and username may not be required).
  • Issue the following commands in the mysql client: UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root'; FLUSH PRIVILEGES;
  • Run GRANT ALL ON *.* TO 'root'@'localhost';

I can close and reopen MySQL Workbench and my root user keeps it's full priviliges but if I restart my computer I am back in the previous insufficient priviliges state and I have to do the whole procedure over again.

How can I make the restore of MySQL root user’s full privileges persistent after restart?

My my.ini looks like this:

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]
# skip_grant_tables

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
explicit_defaults_for_timestamp=TRUE
Community
  • 1
  • 1
BioGeek
  • 21,897
  • 23
  • 83
  • 145
  • 1
    I give the following commands to mysql after resarting `mysqld` with `--skip-grant-tables`: `UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root'; FLUSH PRIVILEGES;` – BioGeek Jul 04 '14 at 08:34
  • And what about the `GRANT ALL ON *.* TO 'root'@'localhost';`? – VMai Jul 04 '14 at 09:17
  • @VMai, yes, I do that too. – BioGeek Jul 04 '14 at 09:47
  • What is happening to your MySQL Users and Privileges table on restart? – Andy Jones Jul 07 '14 at 08:09
  • @AndyJones i guess its a WAMP or something and also some configuration file is read-only. remove read-only from all files, and run as administrator a couple of times doing what you doing so settings may be saved. – Sharky Jul 07 '14 at 08:34

1 Answers1

2

Try a slightly different order of operations:

  1. Stop mysqld and restart it with mysqld --skip-grant-tables option.
  2. Connect to the mysqld server with just: mysql (i.e. no -p option, and username may not be required).
  3. Issue the following commands in the mysql client: UPDATE mysql.user SET Grant_priv='Y',Super_priv='Y' WHERE User='root'; FLUSH PRIVILEGES;
  4. Restart your mysql service
  5. Now run GRANT ALL ON *.* TO 'root'@'localhost';

Let me know if this works.

Shawn
  • 3,583
  • 8
  • 46
  • 63