我在 Windows 计算机上找不到 my.cnf
我的电脑是Windows XP。
我需要找到 my.cnf
才能将所有权限返回给 root 用户。我不小心删除了root用户的一些权限。我还留着密码,以root用户登录MySQL没有问题。但我无法更改表格。
My computer is Windows XP.
I need to find my.cnf
to get all privileges back to the root user. I accidentally removed some privileges of the root user. I still have the password and there is no problem for me to log in to MySQL as the root user. But I can not alter a table.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
这是我的答案:
services.msc
,Enter"D:/Program Files/MySQL/MySQL Server 5.6/bin\mysqld" --defaults-file="D :\ProgramData\MySQL\MySQL Server 5.6\my.ini" MySQL56
完整答案在这里:
https://stackoverflow.com/a/20136523/1316649
Here is my answer:
services.msc
, Enter"D:/Program Files/MySQL/MySQL Server 5.6/bin\mysqld" --defaults-file="D:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MySQL56
Full answer here:
https://stackoverflow.com/a/20136523/1316649
为了回答您的问题,在 Windows 上,
my.cnf
文件可能称为my.ini
。 MySQL 在以下位置(按此顺序)查找它:%PROGRAMDATA%\MySQL\MySQL Server 5.7\my.ini
、%PROGRAMDATA%\MySQL\MySQL Server 5.7\my。 cnf
%WINDIR%\my.ini
,%WINDIR%\my.cnf
C:\my.ini
,C:\my.cnf
\my.ini
,INSTALLDIR\my.cnf
另请参见http://dev.mysql.com/doc/refman /5.7/en/option-files.html
然后您可以编辑配置文件并添加如下条目:
然后重新启动 MySQL 服务,您可以登录并执行您需要执行的操作。当然,您希望尽快在配置文件中禁用该条目!
另请参见http://dev.mysql.com/doc/refman /5.7/en/resetting-permissions.html
To answer your question, on Windows, the
my.cnf
file may be calledmy.ini
. MySQL looks for it in the following locations (in this order):%PROGRAMDATA%\MySQL\MySQL Server 5.7\my.ini
,%PROGRAMDATA%\MySQL\MySQL Server 5.7\my.cnf
%WINDIR%\my.ini
,%WINDIR%\my.cnf
C:\my.ini
,C:\my.cnf
\my.ini
, INSTALLDIR\my.cnf
See also http://dev.mysql.com/doc/refman/5.7/en/option-files.html
Then you can edit the config file and add an entry like this:
Then restart the MySQL Service and you can log in and do what you need to do. Of course you want to disable that entry in the config file as soon as possible!
See also http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
Windows 7 位置为:
C:\Users\All Users\MySQL\MySQL Server 5.5\my.ini
对于 XP 可能为:
C:\Documents and Settings\All Users\MySQL\MySQL Server 5.5\my.ini
这些文件的顶部是定义
my.cnf
位置的注释。Windows 7 location is:
C:\Users\All Users\MySQL\MySQL Server 5.5\my.ini
For XP may be:
C:\Documents and Settings\All Users\MySQL\MySQL Server 5.5\my.ini
At the tops of these files are comments defining where
my.cnf
can be found.如果您在 mysql 客户端(例如 phpmyadmin)中执行以下查询,您可以找到 basedir(可能在您的 my.cnf 中)
You can find the basedir (and within maybe your my.cnf) if you do the following query in your mysql-Client (e.g. phpmyadmin)
你可以搜索这个文件:
resetroot.bat
只需双击它,你的root帐户就会被重置,所有权限都变成YES
you can search this file :
resetroot.bat
just double click it so that your root accout will be reset and all the privileges are turned into YES
开始->搜索->文件和文件夹->所有文件和文件夹
键入“my.cnf”并点击搜索。
Start->Search->For Files and Folders->All Files and Folders
type "my.cnf" and hit search.