当我使用MySQL WorkBench在root
上使用localhost
用户登录并点击Users and Privileges
时,我收到消息'您当前使用的帐户数量不足更改MySQL用户和权限的权限'。
关注the procedure in this answer我可以恢复root
用户的完全权限:
mysqld
并使用--skip-grant-tables
选项重启。mysqld
连接到mysql
服务器(即没有-p
选项,可能不需要用户名。)UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root'; FLUSH PRIVILEGES;
GRANT ALL ON *.* TO 'root'@'localhost';
我可以关闭并重新打开MySQL Workbench并且我的root用户保留了它的完全权限,但是如果我重新启动计算机,我又回到了之前的不充分的特权状态,我必须重新执行整个过程。
如何在重启后恢复MySQL root用户的完全权限?
我的my.ini
看起来像这样:
# 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
答案 0 :(得分:2)
尝试稍微不同的操作顺序:
mysqld --skip-grant-tables
选项重新启动它。UPDATE mysql.user SET Grant_priv='Y',Super_priv='Y' WHERE User='root'; FLUSH PRIVILEGES;
GRANT ALL ON *.* TO 'root'@'localhost'
; 让我知道这是否有效。