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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 14:28:49  来源:igfitidea点击:

I can not find my.cnf on my windows computer

mysqlconfigurationprivileges

提问by Steven

My computer is Windows XP.

我的电脑是 Windows XP。

I need to find my.cnfto 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:

这是我的回答:

  1. Win+R(shortcut for 'run'), type services.msc, Enter
  2. You should find an entry like 'MySQL56', right click on it, select properties
  3. 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
  1. Win+ R(“运行”的快捷方式),输入services.mscEnter
  2. 您应该找到像“MySQL56”这样的条目,右键单击它,选择属性
  3. 你应该看到类似的东西 "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

完整答案在这里:https: //stackoverflow.com/a/20136523/1316649

回答by Bill Karwin

To answer your question, on Windows, the my.cnffile 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.cnfcan 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”并点击搜索。