未指定 MySQL 配置文件(即:my.cnf)的位置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39822702/
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
Location of MySQL configuration file (ie: my.cnf) not specified
提问by Tedd Ang Teck Loon
回答by maritree
I solved this problem. Step one: click here
我解决了这个问题。第一步:点击这里
Step two: and then click here to choose your path
第二步:然后点击这里选择你的路径
Step three: my path is C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
第三步:我的路径是 C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
回答by not2savvy
If you already know where your configuration file is located, but just don't know how to specify it in mySQLWorkbench, you can skip steps 1-3 and just follow step 4 in these instructions.
如果您已经知道您的配置文件所在的位置,但只是不知道如何在 mySQLWorkbench 中指定它,您可以跳过步骤 1-3,只需按照这些说明中的步骤 4 进行操作。
Step 1: Make sure which mysql is running (just in case you have multiple installations on your system) and how:
步骤 1:确保哪个 mysql 正在运行(以防万一您的系统上有多个安装)以及如何:
$ ps aux | grep mysql
may result in something like:
可能会导致类似:
_mysql 120 0,0 3,4 5122736 565108 ?? Ss Fr01pm 61:05.93 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid
If, in this output, you see that mysqld has been started with the --defaults-file
option, that option specifies the configuration file used by msql. If so, you have found the configuration file and can skip to step 4.
如果在此输出中,您看到 mysqld 已使用该--defaults-file
选项启动,则该选项指定 msql 使用的配置文件。如果是这样,您已经找到了配置文件,可以跳到第 4 步。
If not, check if this returns the same binary location as above command:
如果没有,请检查这是否返回与上述命令相同的二进制位置:
$ which mysqld
If not, then make sure you use the full path for mysqld from the first output in the following step.
如果没有,请确保您使用以下步骤中第一个输出中的 mysqld 完整路径。
Step 2: Ask mySQL which configuration files it is using:
第 2 步:询问 mySQL 它正在使用哪些配置文件:
$ mysqld --verbose --help | grep -A 1 "Default options"
should output something like:
应该输出类似:
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
Step 3: Check the given locations in that order. The first finding should be your mySQL configuration file.
第 3 步:按顺序检查给定的位置。第一个发现应该是您的 mySQL 配置文件。
Step 4: In mySQLWorkbench go to Database > Manage Connections, then select the connection, select tab System Profile, and enter the path and file name in Configuration File.
步骤 4:在 mySQLWorkbench 中,转到Database > Manage Connections,然后选择连接,选择选项卡System Profile,然后在Configuration File 中输入路径和文件名。
This should be it.
应该是这样。
回答by user9424581
And if still nothing happens, you may have used the installer Package. If you have, then you must select the Installation Type from the drop-down to reflect that before you locate the configuration file.
如果仍然没有任何反应,您可能已经使用了安装程序包。如果有,那么在找到配置文件之前,您必须从下拉列表中选择安装类型以反映它。
Here's a screenshot that follows from the above screenshots
Also, there may not be a config file and you can create one here, then get out of the Options File, go back in and you will see all the options.
此外,可能没有配置文件,您可以在此处创建一个,然后退出选项文件,返回,您将看到所有选项。
回答by ketchuponpizza
I changed my setting from Custom to MacOSx (MySQL Package) under: Database → Manage Connections → MySQL Connections → Select DB Connection → System Profile → Installation Type → (default setting) MySQL Package.
我将我的设置从自定义更改为 MacOSx(MySQL 包):数据库 → 管理连接 → MySQL 连接 → 选择数据库连接 → 系统配置文件 → 安装类型 →(默认设置)MySQL 包。
Change from custom to default setting:
从自定义更改为默认设置:
Reconnect by testing connection:
通过测试连接重新连接:
回答by hoymkot
For maria-db users
对于 maria-db 用户
- back up the original /etc/mysql/my.cnf
- copy and rename /etc/mysql/mariadb.conf.d/50-server.cnf to /etc/mysql/my.cnf.
- 备份原来的/etc/mysql/my.cnf
- 将 /etc/mysql/mariadb.conf.d/50-server.cnf 复制并重命名为 /etc/mysql/my.cnf。
This would fix the problem.
这将解决问题。
Remember to revert changes after finish.
请记住在完成后还原更改。