简体   繁体   English

在我的目录中看不到/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf〜/ .my.cnf中的任何一个

[英]Cannot see any of /etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf in my dir

I'm trying to find file my.cnf per this SO post. 我正在尝试根据此SO帖子查找文件my.cnf With one of the answers there I typed mysqladmin --help after ssh ing into my remote server. 使用答案之一,我将ssh切换到远程服务器后输入了mysqladmin --help

Part of the output: 部分输出:

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf 

So from my root, I typed ls -la to see all files: 所以从我的根源起,我键入ls -la来查看所有文件:

drwxr-xr-x 4 ubuntu ubuntu 4096 Jul 18 02:03 .
drwxr-xr-x 3 root   root   4096 Jul 17 14:06 ..
-rw-r--r-- 1 ubuntu ubuntu  220 Apr  9  2014 .bash_logout
-rw-r--r-- 1 ubuntu ubuntu 3637 Apr  9  2014 .bashrc
drwx------ 2 ubuntu ubuntu 4096 Jul 17 14:09 .cache
-rw-rw-r-- 1 ubuntu ubuntu    0 Jul 17 14:09 .cloud-locale-test.skip
-rw------- 1 ubuntu ubuntu 1004 Jul 18 02:03 .mysql_history
-rw-r--r-- 1 ubuntu ubuntu  675 Apr  9  2014 .profile
drwx------ 2 ubuntu ubuntu 4096 Jul 17 14:06 .ssh

There's no etc folder to look for my.cnf. 没有etc文件夹可查找my.cnf。 Where would this file be? 该文件在哪里?

I think your current folder is wrong, using command pwd to know where you are. 我认为您当前的文件夹是错误的,请使用命令pwd知道您的位置。 From your root, try cd to those folders, then use ls -la: 从您的根目录,尝试cd到那些文件夹,然后使用ls -la:

cd /etc
ls -la

cd /etc/mysql
ls -la

cd /usr/etc
ls -la
/etc <-- is a directory
/etc/my.cnf <-- is a file
/etc/mysql <-- directory
/etc/mysql/my.cnf <-- file
/usr <-- directory
/usr/mysql <-- directory
/usr/mysql/my.cnf <-- file

~/ <-- ~ special notation to indicate home directory of the current logged in user
~/.my.cnf <-- user specific config for MySQL

You can edit the files and change directories to the directories. 您可以编辑文件并将目录更改为目录。

cd /etc
vi /etc/my.cnf

The location of your specific config is dependent on how you installed mysql. 具体配置的位置取决于安装mysql的方式。 If you used apt-get I believe its located in /etc/mysql/my.cnf. 如果您使用apt-get,我相信它位于/etc/mysql/my.cnf中。 Therefor to edit the file you could run: 为此,可以编辑您可以运行的文件:

vi /etc/mysql/my.cnf

typically ~/.my.cnf is used for User-specific options. 通常〜/ .my.cnf用于特定于用户的选项。 Please see https://dev.mysql.com/doc/refman/8.0/en/option-files.html 请参阅https://dev.mysql.com/doc/refman/8.0/en/option-files.html

Found the answer over here . 这里找到答案。 I am in the root directory not / (confusing). 我在根目录中不是/(令人困惑)。

cd /

Then I could see directory. 然后我可以看到目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM