gpt4 book ai didi

c# - MySQL zip 安装默认文件 my.ini 在安装过程中无法打开

转载 作者:行者123 更新时间:2023-11-29 10:29:38 25 4
gpt4 key购买 nike

我有一个从 zip 文件安装 MySQL 的程序。程序可以将zip文件中的文件解压到Program Files文件夹中,并在Program Files文件夹中为mysql创建一个名为“my.ini”的选项文件。

解压完成后,程序将通过运行mysqld.exe来初始化数据文件夹和文件。

该程序通过带有一些参数的Process.Start()运行mysqld.exe。论据是--defaults-file=C:\\Program Files\\MySQL\\my.ini --initialize-insecure --console

当我尝试使用该参数运行 mysqld.exe 时,它​​会抛出类似以下错误:

mysqld: [ERROR] Could not open required defaults file: C:\Program
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!

我的代码如下;

        Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.WorkingDirectory = destPath + "\\bin";
p.StartInfo.FileName = destPath + "\\bin\\mysqld.exe";
p.StartInfo.Arguments = "--defaults-file=" + destPath + "\\my.ini --initialize-insecure --console";
p.OutputDataReceived += P_OutputDataReceived;
p.Start();

// destPath:"C:\\Program Files\\MySQL"

最佳答案

我解决了。 my.ini 文件必须放置到如下路径;

enter image description here

更多信息可以在下面找到 https://dev.mysql.com/doc/refman/5.7/en/option-files.html

关于c# - MySQL zip 安装默认文件 my.ini 在安装过程中无法打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47652105/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com