繁体   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

我正在尝试根据此SO帖子查找文件my.cnf 使用答案之一,我将ssh切换到远程服务器后输入了mysqladmin --help

部分输出:

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 

所以从我的根源起,我键入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

没有etc文件夹可查找my.cnf。 该文件在哪里?

我认为您当前的文件夹是错误的,请使用命令pwd知道您的位置。 从您的根目录,尝试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

您可以编辑文件并将目录更改为目录。

cd /etc
vi /etc/my.cnf

具体配置的位置取决于安装mysql的方式。 如果您使用apt-get,我相信它位于/etc/mysql/my.cnf中。 为此,可以编辑您可以运行的文件:

vi /etc/mysql/my.cnf

通常〜/ .my.cnf用于特定于用户的选项。 请参阅https://dev.mysql.com/doc/refman/8.0/en/option-files.html

这里找到答案。 我在根目录中不是/(令人困惑)。

cd /

然后我可以看到目录。

暂无
暂无

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

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