我不小心从mariadb中删除了唯一用户的DBA特权,现在我无法使用银行,也无法使用Linux SHELL CentOS 7还原特权。
我尝试的命令:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
返回:
#1045 - Access denied for user 'root'@'localhost' (using password: YES)
有没有人经历过?

最佳答案

停止MariaDb服务器sudo systemctl stop mariadb在没有权限检查的情况下重新启动数据库-moresudo mysqld_safe --skip-grant-tables --skip-networking &mysql -u root输入密码
重新加载拨款表Mariadb[MYSQL]> FLUSH PRIVILEGES

insert into user (Host, User, Password, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, ssl_type, ssl_cipher, x509_issuer, x509_subject, max_questions, max_updates, max_connections, max_user_connections)
values('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','','0','0','0','0');
然后重启数据库sudo systemctl start mariadb希望这对您有用。它确实为我工作。
您可以在Grant privileges on MariaDB上探索答案

07-24 09:49
查看更多