gpt4 book ai didi

mysql - 在 MariaDB 上恢复我的 root 用户的 DBA 权限

转载 作者:行者123 更新时间:2023-12-03 09:57:50 25 4
gpt4 key购买 nike

我不小心从 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 上探索答案

关于mysql - 在 MariaDB 上恢复我的 root 用户的 DBA 权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63013487/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com