c# 实现查找mysql安装路径

1.c#能够调用msyql的导入导出命令,可是须要先推断客户机是否安装了mysql。及其安装mysql的路径问题。

2.查询mysql安装路径的函数

  private string GetMysqlPath()
        {
            string strPath = string.Empty;
            string strsql = "select @@basedir as basePath from dual ";
            strPath = 数据库运行当前的strsql

            strPath = strPath.Replace("/", "\");
            return strPath;
        }

3.获取mysql的安装bin路径

strmysqlPath= GetMysqlPath() + "\bin";

4.然后依据上一篇中的博客,对mysql进行附加和备份功能。

原文地址:https://www.cnblogs.com/yangykaifa/p/6706145.html