如何在MySQL中将所有特权返回给root用户? [英] How to get all privileges back to the root user in MySQL?

查看:74
本文介绍了如何在MySQL中将所有特权返回给root用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MySQL.我的root用户没有所有特权.我如何才能将所有特权返回给root用户?如何逐步进行?

I am using MySQL. My root user doesn't have all privileges. How can I get all privileges back to the root user? How to do it step by step?

推荐答案

这在Ubuntu上对我有用:

This worked for me on Ubuntu:

停止MySQL服务器:

Stop MySQL server:

/etc/init.d/mysql stop

从命令行启动MySQL:

Start MySQL from the commandline:

/usr/sbin/mysqld

在另一个终端中,输入mysql并发出:

In another terminal enter mysql and issue:

grant all privileges on *.* to 'root'@'%' with grant option;

您可能还想添加

grant all privileges on *.* to 'root'@'localhost' with grant option;

,还可以选择使用密码.

and optionally use a password as well.

flush privileges;

,然后退出MySQL提示符,然后终止在前台运行的mysqld服务器.重新开始

and then exit your MySQL prompt and then kill the mysqld server running in the foreground. Restart with

/etc/init.d/mysql start  

这篇关于如何在MySQL中将所有特权返回给root用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆