如何使用 --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.
推荐答案
我遇到了与此问题标题相同的问题,因此如果其他人在 google 上搜索此问题并想在skip-grant-tables"中启动 MySqlWindows 上的模式,这就是我所做的.
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.
相关文章