C# MySQL 接続の問題: 指定された MySQL ホストに接続できません
P粉994092873
P粉994092873 2023-08-20 19:50:26
0
1
458
<p>次のコードを実行すると、上記のエラーが発生しました -</p> <pre class="brush:php;toolbar:false;">MySqlConnection mysqlConn=new MySqlConnection("server=127.0.0.1;uid=pankaj;port=3306;pwd=master;database=patholabs;"); mysqlConn.Open();</pre> <p>サーバーを localhost に設定し、ユーザーを root に設定しようとしましたが、次のエラーが発生しました -</p> <pre class="brush:php;toolbar:false;">エラー: 0: 指定された MySQL ホストのいずれにも接続できません。 System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft. com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>未処理の例外</Description><AppDomain>DBSync.exe</AppDomain><Exception><ExceptionType> MySql.Data.MySqlClient.MySqlException、MySql.Data、Version=6.7.4.0、Culture=neutral、PublicKeyToken=c5687fc88969c44d</ExceptionType><Message>指定された MySQL ホストのいずれにも接続できません。</メッセージ><スタックトレース> MySql.Data.MySqlClient.NativeDriver.Open() で MySql.Data.MySqlClient.Driver.Open() で MySql.Data.MySqlClient.Driver.Create (MySqlConnectionStringBuilder 設定) で MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() で MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() で MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() で MySql.Data.MySqlClient.MySqlPool.GetConnection() で MySql.Data.MySqlClient.MySqlConnection.Open() で DBSync.MainForm.BtnCalculateClick(Object sender, EventArgs e) (c:Documents and SettingsTest01My DocumentsSharpDevelop ProjectsDBSyncDBSyncMainForm.cs:line 51) で System.Windows.Forms.Control.OnClick(EventArgs e) で System.Windows.Forms.Button.OnClick(EventArgs e) で System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) で System.Windows.Forms.Control.WmMouseUp(メッセージ&amp;m、マウスボタン ​​ボタン、Int32 クリック) System.Windows.Forms.Control.WndProc(Message&amp;amp; m) で System.Windows.Forms.ButtonBase.WndProc(Message&amp;amp; m) で System.Windows.Forms.Button.WndProc(Message&amp;amp; m) で System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp;amp; m) で System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp;amp; m) で System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd、Int32 msg、IntPtr wparam、IntPtr lparam) で System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp;amp; msg) で System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop で (IntPtr dwComponentID、Int32 理由、Int32 pvLoopData) System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner で (Int32 理由、ApplicationContext コンテキスト) System.Windows.Forms.Application.ThreadContext.RunMessageLoop で (Int32 理由、ApplicationContext コンテキスト) System.Windows.Forms.Application.Run(フォーム mainForm) で DBSync.Program.Main(String[] args) in c:Documents and SettingsTest01My DocumentsSharpDevelop ProjectsDBSyncDBSyncProgram.cs:line 27</StackTrace><ExceptionString>MySql.Data.MySqlClient.MySqlException (0x80004005): 指定されたものには接続できませんMySQL メインマシン。MySql.Data.MySqlClient.NativeDriver.Open() で MySql.Data.MySqlClient.Driver.Open() で MySql.Data.MySqlClient.Driver.Create (MySqlConnectionStringBuilder 設定) で MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() で MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() で MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() で MySql.Data.MySqlClient.MySqlPool.GetConnection() で MySql.Data.MySqlClient.MySqlConnection.Open() で DBSync.MainForm.BtnCalculateClick(Object sender, EventArgs e) (c:Documents and SettingsTest01My DocumentsSharpDevelop ProjectsDBSyncDBSyncMainForm.cs:line 51) で System.Windows.Forms.Control.OnClick(EventArgs e) で System.Windows.Forms.Button.OnClick(EventArgs e) で System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) で System.Windows.Forms.Control.WmMouseUp(メッセージ&amp;m、マウスボタン ​​ボタン、Int32 クリック) System.Windows.Forms.Control.WndProc(Message&amp;amp; m) で System.Windows.Forms.ButtonBase.WndProc(Message&amp;amp; m) で System.Windows.Forms.Button.WndProc(Message&amp;amp; m) で System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp;amp; m) で System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp;amp; m) で System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd、Int32 msg、IntPtr wparam、IntPtr lparam) で System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp;amp; msg) で System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop で (IntPtr dwComponentID、Int32 理由、Int32 pvLoopData) System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner で (Int32 理由、ApplicationContext コンテキスト) System.Windows.Forms.Application.ThreadContext.RunMessageLoop で (Int32 理由、ApplicationContext コンテキスト) System.Windows.Forms.Application.Run(フォーム mainForm) で DBSync.Program.Main(String[] args) in c:Documents and SettingsTest01My DocumentsSharpDevelop ProjectsDBSyncDBSyncProgram.cs:line 27</ExceptionString><DataItems><Data><Key>サーバー エラー コード</Key><値>1042<< <p>mysql ワークベンチを介して mysql サーバーに接続し、データベースを確認することができます。 追記:sharpdevelop を使用すると問題が発生しますが、Visual Studio を使用すると問題が発生しないことに気付きました。
P粉994092873
P粉994092873

全員に返信(1)
P粉078945182

接続文字列の間隔はパラメータの順序に関係する場合があります (個人的な経験と長い夜に基づいています:S)

標準形式にこだわる場合は、ここを参照してください

いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!