国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

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

2024-07-24 13:10:25
字體:
來源:轉載
供稿:網友

MySql Server安裝步驟如下所示:

1安裝MySql Server

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

2 安裝MySqlServer管理工具

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

解壓中文語言包,將文件復制到安裝目錄下覆蓋

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

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

mysql,安裝,中文亂碼

mysql,安裝,中文亂碼

3 MySqlServer開發注意事項(C#)

1.聯接字符串:"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如果要轉為int類型,必須使用Convert來強制轉換,否則可能會出錯。

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

7.命令行工具:

public class Cmd{/// <summary>/// 執行Cmd命令/// </summary>/// <param name="workingDirectory">要啟動的進程的目錄</param>/// <param name="command">要執行的命令</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{//構建執行的命令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服務MessageBox.Show(@"數據庫已成功備份到 " + backupPath + " 文件中", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);return true;}catch (Exception){MessageBox.Show("數據庫備份失敗!");return false;}}

還原:

/// <summary>/// 數據還原/// </summary>/// <param name="FilePath">文件路徑</param>/// <returns></returns>public static bool RestoreDB(string FilePath){try{StringBuilder sbcommand = new StringBuilder();//在文件路徑后面加上""避免空格出現異常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("您是否真的想覆蓋以前的數據庫嗎?那么以前的數據庫數據將丟失!!!", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);if (result == DialogResult.Yes){Cmd.StartCmd(appDirecroty, command);Cmd.StartCmd();//重啟mysql服務MessageBox.Show("數據庫還原成功!");return true;}return false;}catch (Exception){MessageBox.Show("數據庫還原失敗!");return false;}}

以上所述是小編給大家介紹的MySql安裝步驟圖文教程及中文亂碼的解決方案,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對VeVb武林網網站的支持!


注:相關教程知識閱讀請移步到MYSQL教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 宝丰县| 烟台市| 抚松县| 陆丰市| 昌吉市| 桐柏县| 丰台区| 收藏| 香河县| 汉阴县| 韶山市| 天气| 台北市| 陆丰市| 曲麻莱县| 宜都市| 鸡东县| 桂平市| 武功县| 襄垣县| 磐石市| 桦川县| 东宁县| 新竹市| 临湘市| 绵阳市| 万宁市| 辽源市| 雅江县| 桂阳县| 芮城县| 榕江县| 来凤县| 旬阳县| 九龙城区| 合江县| 苍梧县| 六枝特区| 清涧县| 兴和县| 巴彦淖尔市|