我在我的windows电脑上找不到my.cnf[复制]

时间:2022-10-02 06:59:59

This question already has an answer here:

这个问题已经有了答案:

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将所有的特权返回给根用户。我不小心删除了根用户的一些特权。我仍然有密码,我作为根用户登录MySQL是没有问题的。但是我不能改变桌子。

6 个解决方案

#1


76  

Here is my answer:

这是我的回答:

  1. Win+R(shortcut for 'run'), type services.msc, Enter
  2. Win+R(运行的快捷方式),类型服务。msc,输入
  3. You could find an entry like 'MySQL56', right click on it, select properties
  4. 你可以找到一个类似“MySQL56”的条目,右键点击,选择属性。
  5. You could see sth like "D:/Program Files/MySQL/MySQL Server 5.6/bin\mysqld" --defaults-file="D:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MySQL56
  6. 你可以看到“D:/程序文件/MySQL/MySQL Server 5.6/bin\mysqld”——default -file=“D:\ProgramData\MySQL Server 5.6\my”。ini”MySQL56

Full answer here: https://*.com/a/20136523/1316649

完整的答案:https://*.com/a/20136523/1316649

#2


39  

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
  • % PROGRAMDATA % \ MySQL \ 5.7 \我的MySQL服务器。ini,MySQL % PROGRAMDATA % \ \ MySQL服务器。5.7 \ my . cnf中所做
  • %WINDIR%\my.ini, %WINDIR%\my.cnf
  • % % \我列出。。ini,%列出% \ my . cnf中所做
  • C:\my.ini, C:\my.cnf
  • C:\我。。ini,C:\ my . cnf中所做
  • INSTALLDIR\my.ini, INSTALLDIR\my.cnf
  • INSTALLDIR \我。。ini,INSTALLDIR \ 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

#3


10  

Windows 7 location is: C:\Users\All Users\MySQL\MySQL Server 5.5\my.ini

Windows 7的位置是:用户所有用户\MySQL\MySQL服务器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用户\ MySQL \ 5.5 \ my.ini MySQL服务器

At the tops of these files are comments defining where my.cnf can be found.

在这些文件的顶部是注释,定义了可以找到my.cnf的位置。

#4


1  

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

#5


0  

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。

#6


-4  

Start->Search->For Files and Folders->All Files and Folders

开始->搜索->文件和文件夹->所有文件和文件夹。

type "my.cnf" and hit search.

输入“my.cnf”并点击搜索。

#1


76  

Here is my answer:

这是我的回答:

  1. Win+R(shortcut for 'run'), type services.msc, Enter
  2. Win+R(运行的快捷方式),类型服务。msc,输入
  3. You could find an entry like 'MySQL56', right click on it, select properties
  4. 你可以找到一个类似“MySQL56”的条目,右键点击,选择属性。
  5. You could see sth like "D:/Program Files/MySQL/MySQL Server 5.6/bin\mysqld" --defaults-file="D:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MySQL56
  6. 你可以看到“D:/程序文件/MySQL/MySQL Server 5.6/bin\mysqld”——default -file=“D:\ProgramData\MySQL Server 5.6\my”。ini”MySQL56

Full answer here: https://*.com/a/20136523/1316649

完整的答案:https://*.com/a/20136523/1316649

#2


39  

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
  • % PROGRAMDATA % \ MySQL \ 5.7 \我的MySQL服务器。ini,MySQL % PROGRAMDATA % \ \ MySQL服务器。5.7 \ my . cnf中所做
  • %WINDIR%\my.ini, %WINDIR%\my.cnf
  • % % \我列出。。ini,%列出% \ my . cnf中所做
  • C:\my.ini, C:\my.cnf
  • C:\我。。ini,C:\ my . cnf中所做
  • INSTALLDIR\my.ini, INSTALLDIR\my.cnf
  • INSTALLDIR \我。。ini,INSTALLDIR \ 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

#3


10  

Windows 7 location is: C:\Users\All Users\MySQL\MySQL Server 5.5\my.ini

Windows 7的位置是:用户所有用户\MySQL\MySQL服务器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用户\ MySQL \ 5.5 \ my.ini MySQL服务器

At the tops of these files are comments defining where my.cnf can be found.

在这些文件的顶部是注释,定义了可以找到my.cnf的位置。

#4


1  

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

#5


0  

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。

#6


-4  

Start->Search->For Files and Folders->All Files and Folders

开始->搜索->文件和文件夹->所有文件和文件夹。

type "my.cnf" and hit search.

输入“my.cnf”并点击搜索。