最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

MySql安裝步驟圖文教程及中文亂碼的解決方案

 更新時(shí)間:2016年08月30日 15:35:26   作者:BennyHua  
這篇文章主要介紹了MySql安裝步驟圖文教程及中文亂碼的解決方案,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下

MySql Server安裝步驟如下所示:

1安裝MySql Server

2 安裝MySqlServer管理工具

解壓中文語(yǔ)言包,將文件復(fù)制到安裝目錄下覆蓋

文件覆蓋后,打開軟件設(shè)置語(yǔ)言為中文(CN)

3 MySqlServer開發(fā)注意事項(xiàng)(C#)

1.聯(lián)接字符串:"Server=localhost;Database=100;Uid=root;Pwd='root'"

2.引用MySql.Data.dll;using MySql.Data.MySqlClient;

3.使用MySqlConnection、MySqlParameter、MySqlDataAdapter、MySqlCommandBuilder、MySqlCommand、MySqlDataAdapter、MySqlTransaction等類

5.使用MySqlCommand. ExecuteScalar()方法返回的object如果要轉(zhuǎn)為int類型,必須使用Convert來(lái)強(qiáng)制轉(zhuǎn)換,否則可能會(huì)出錯(cuò)。

6.修改記錄時(shí),字段數(shù)據(jù)類型如果為Bit類型的時(shí)候,Sql語(yǔ)句中的字段值要使用Ture或False,不能像SqlServer中一樣使用0或1。

7.命令行工具:

public class Cmd
{
/// <summary>
/// 執(zhí)行Cmd命令
/// </summary>
/// <param name="workingDirectory">要啟動(dòng)的進(jìn)程的目錄</param>
/// <param name="command">要執(zhí)行的命令</param>
public static void StartCmd(String workingDirectory, String command)
{
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.WorkingDirectory = workingDirectory;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardInput.WriteLine(command);
Thread.Sleep(10000);
//p.StandardInput.WriteLine("exit");
}
public static void StartCmd()
{
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardInput.WriteLine("net stop mysql");
Thread.Sleep(5000);
p.StandardInput.WriteLine("net start mysql");
Thread.Sleep(5000);
p.StandardInput.WriteLine("exit");
}
}

備份:

public static bool BackUp(string backupPath)
{
try
{
//構(gòu)建執(zhí)行的命令
StringBuilder sbcommand = new StringBuilder();
sbcommand.AppendFormat("mysqldump -f -l -q -uroot -proot Sciendox50 -r \"{0}\"", backupPath);
String command = sbcommand.ToString();
//獲取mysqldump.exe所在路徑
String appDirecroty = @"C:\Program Files\MySQL\MySQL Server 5.5\bin\";
Cmd.StartCmd(appDirecroty, command);
Cmd.StartCmd();//重啟mysql服務(wù)
MessageBox.Show(@"數(shù)據(jù)庫(kù)已成功備份到 " + backupPath + " 文件中", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return true;
}
catch (Exception)
{
MessageBox.Show("數(shù)據(jù)庫(kù)備份失敗!");
return false;
}
}

還原:

/// <summary>
/// 數(shù)據(jù)還原
/// </summary>
/// <param name="FilePath">文件路徑</param>
/// <returns></returns>
public static bool RestoreDB(string FilePath)
{
try
{
StringBuilder sbcommand = new StringBuilder();
//在文件路徑后面加上""避免空格出現(xiàn)異常
sbcommand.AppendFormat("mysql -uroot -proot Sciendox50 <\"{0}\"", FilePath);
String command = sbcommand.ToString();
//獲取mysql.exe所在路徑
String appDirecroty = @"C:\Program Files\MySQL\MySQL Server 5.5\bin\";
DialogResult result = MessageBox.Show("您是否真的想覆蓋以前的數(shù)據(jù)庫(kù)嗎?那么以前的數(shù)據(jù)庫(kù)數(shù)據(jù)將丟失!?。?, "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
Cmd.StartCmd(appDirecroty, command);
Cmd.StartCmd();//重啟mysql服務(wù)
MessageBox.Show("數(shù)據(jù)庫(kù)還原成功!");
return true;
}
return false;
}
catch (Exception)
{
MessageBox.Show("數(shù)據(jù)庫(kù)還原失?。?);
return false;
}
}

以上所述是小編給大家介紹的MySql安裝步驟圖文教程及中文亂碼的解決方案,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

  • MySQL中SQL分頁(yè)查詢的幾種實(shí)現(xiàn)方法及優(yōu)缺點(diǎn)

    MySQL中SQL分頁(yè)查詢的幾種實(shí)現(xiàn)方法及優(yōu)缺點(diǎn)

    這篇文章主要介紹了MySQL中SQL分頁(yè)查詢的幾種實(shí)現(xiàn)方法及優(yōu)缺點(diǎn), 分頁(yè)查詢就是在滿足條件的一堆有序數(shù)據(jù)中截取當(dāng)前所需要展示的那部分。對(duì)此感興趣的可以來(lái)了解一下
    2020-07-07
  • navicat連接mysql修改root密碼最簡(jiǎn)潔方法

    navicat連接mysql修改root密碼最簡(jiǎn)潔方法

    這篇文章主要介紹了navicat連接mysql修改root密碼,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-05-05
  • 最新評(píng)論

    乃东县| 古交市| 万年县| 乌鲁木齐县| 科技| 吉木乃县| 十堰市| 衡南县| 来凤县| 沙田区| 长阳| 莒南县| 侯马市| 南充市| 沂水县| 甘谷县| 石渠县| 阳江市| 塘沽区| 南靖县| 阿坝县| 南宫市| 上林县| 广灵县| 凤台县| 运城市| 临颍县| 曲松县| 阳谷县| 沙河市| 七台河市| 剑川县| 桂平市| 祥云县| 隆昌县| 辽中县| 宁远县| 万州区| 井陉县| 阜宁县| 阜新市|