C#中实现查找mysql的安装路径
发布时间:2016-12-28 来源:查字典编辑
摘要:1.c#可以调用msyql的导入导出命令,但是需要先判断客户机是否安装了mysql,及其安装mysql的路径问题。2.查询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进行附加和备份功能。