MySQL 我在 Windows 计算机上找不到 my.cnf
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1712646/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I can not find my.cnf on my windows computer
提问by Steven
My computer is Windows XP.
我的电脑是 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.
我需要找到my.cnf
将所有权限返回给 root 用户。我不小心删除了 root 用户的一些权限。我还有密码,我以root用户登录MySQL没有问题。但我不能改变一个表。
回答by fstang
Here is my answer:
这是我的回答:
- Win+R(shortcut for 'run'), type
services.msc
, Enter - You should find an entry like 'MySQL56', right click on it, select properties
- You should see something like
"D:/Program Files/MySQL/MySQL Server 5.6/bin\mysqld" --defaults-file="D:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MySQL56
- Win+ R(“运行”的快捷方式),输入
services.msc
,Enter - 您应该找到像“MySQL56”这样的条目,右键单击它,选择属性
- 你应该看到类似的东西
"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
回答by Bill Karwin
To answer your question, on Windows, the my.cnf
file may be called my.ini
. MySQL looks for it in the following locations (in this order):
为了回答您的问题,在 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
- INSTALLDIR
\my.ini
, INSTALLDIR\my.cnf
%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
,安装程序\my.cnf
See also http://dev.mysql.com/doc/refman/5.7/en/option-files.html
另见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:
然后您可以编辑配置文件并添加如下条目:
[mysqld]
skip-grant-tables
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!
然后重启MySQL服务就可以登录了,做自己需要做的事情。当然,您希望尽快禁用配置文件中的该条目!
See also http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
另见http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
回答by Alberto
Windows 7 location is: C:\Users\All Users\MySQL\MySQL Server 5.5\my.ini
Windows 7 位置是: 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
对于 XP 可能是: 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.
这些文件的顶部是定义my.cnf
可以找到的位置的注释。
回答by digitaldonkey
You can find the basedir (and within maybe your my.cnf) if you do the following query in your mysql-Client (e.g. phpmyadmin)
如果您在 mysql-Client(例如 phpmyadmin)中执行以下查询,您可以找到 basedir(可能在您的 my.cnf 中)
SHOW VARIABLES
回答by Treby
you can search this file : resetroot.bat
你可以搜索这个文件: resetroot.bat
just double click it so that your root accout will be reset and all the privileges are turned into YES
只需双击它,您的根帐户将被重置,所有权限都变为 YES
回答by Jeremy Morgan
Start->Search->For Files and Folders->All Files and Folders
开始->搜索->文件和文件夹->所有文件和文件夹
type "my.cnf" and hit search.
输入“my.cnf”并点击搜索。