MySQL 为什么我找不到my.cnf?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1876005/
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:44:08  来源:igfitidea点击:

why can't I find my.cnf?

mysqldatabaselinuxunixaptitude

提问by TIMEX

I did updatedb. I did locate my.cnf

我没有更新b。我确实找到了 my.cnf

But I cannot find it? Nothing.

但是我找不到?没有。

(I installed MYSQL using aptitude install mysql-server, and mysql does work right now.)

(我使用 aptitude install mysql-server 安装了 MYSQL,并且 mysql 现在可以正常工作。)

回答by Sam Alba

What is your operating system ? On Debian Linux, it is located on /etc/mysql/my.cnf. If your cannot find it, you can create one from scratch using this documentation.

你的操作系统是什么?在 Debian Linux 上,它位于 /etc/mysql/my.cnf。如果您找不到它,您可以使用本文档从头开始创建一个。

回答by psihodelia

You can try following command:

您可以尝试以下命令:

find /etc -name *.cnf

find /etc -name *.cnf

it will show you all locations of *.cnf files

它将显示 *.cnf 文件的所有位置

回答by Peter Cordes

locate will only print files in directories that you can read.

locate 只会打印您可以阅读的目录中的文件。

Also, when you say you did updatedb, did you run

另外,当你说你做了updatedb,你跑了吗

sudo /etc/cron.daily/slocate

sudo /etc/cron.daily/slocate

If not, then probably what you did run wasn't equivalent. (The default locate program on Debian/Ubuntu these days is mlocate).

如果不是,那么您所做的运行可能并不等效。(现在 Debian/Ubuntu 上的默认定位程序是 mlocate)。

回答by Lijo

create a configuration file MySQL provides several configuration methods but, in general, it is easiest to to create a my.ini file in the mysql folder. There are hundreds of options to tweak MySQL to your exact requirements, but the simplest my.ini file is:

创建配置文件 MySQL 提供了几种配置方法,但一般来说,在 mysql 文件夹中创建一个 my.ini 文件是最容易的。有数百种选项可以根据您的具体要求调整 MySQL,但最简单的 my.ini 文件是:

[mysqld]
# installation directory
basedir="C:/mysql/"

# data directory
datadir="D:/MySQLdata/"