如何使用--skip-grant-tables启动MySQL? [英] How to start MySQL with --skip-grant-tables?

查看:209
本文介绍了如何使用--skip-grant-tables启动MySQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将root用户从数据库中锁定了.我需要将所有特权返回给root用户.我有密码,可以登录MySQL.但是root用户没有所有特权.

I locked my root user out from our database. I need to get all privileges back to the root user. I have my password and I can log in to MySQL. But the root user has no all privileges.

推荐答案

我遇到的问题与该问题的标题相同,因此,以防万一其他人谷歌搜索此问题并想在"skip-grant-tables"中启动MySql Windows下的模式,这就是我所做的.

I had the same problem as the title of this question, so incase anyone else googles upon this question and wants to start MySql in 'skip-grant-tables' mode on Windows, here is what I did.

通过管理员工具服务停止MySQL服务.

Stop the MySQL service through Administrator tools, Services.

修改my.ini配置文件(假定默认路径)

Modify the my.ini configuration file (assuming default paths)

C:\Program Files\MySQL\MySQL Server 5.5\my.ini

或对于MySQL版本> = 5.6

or for MySQL version >= 5.6

C:\ProgramData\MySQL\MySQL Server 5.6\my.ini 

在服务器部分的[mysqld]下,添加以下行:

In the SERVER SECTION, under [mysqld], add the following line:

skip-grant-tables

让您拥有

# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
[mysqld]

skip-grant-tables

再次启动该服务,您应该无需密码即可登录数据库.

Start the service again and you should be able to log into your database without a password.

这篇关于如何使用--skip-grant-tables启动MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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