Visual C# i MySQL - połączenie z lokalną bazą

0

Witam.
Czy ktoś mógłby mi pomóc zbudować prawidłowy ConnectionString...?

'MySql.Data.MySqlClient.MySqlConnection connection = new MySql.Data.MySqlClient.MySqlConnection("Database=msdb;Data Source=MySQL@local;User Id=root@localhost;Password=haslo"); //parametry servera zamieściłem w załączniku

connection.Open(); // w tym miejscu wyrzuaca wyjątek "Unable to connect to any of the specified MySQL hosts.":
'

MySql.Data.MySqlClient.MySqlException was unhandled
Message="Unable to connect to any of the specified MySQL hosts."
Source="MySql.Data"
ErrorCode=-2147467259
Number=1042
StackTrace:
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at aplikacja.Form1.button1_Click(Object sender, EventArgs e) in D:\Documents and Settings\ppp_6\My Documents\Visual Studio 2008\Projects\WindowsFormsApplication18\WindowsFormsApplication18\Form1.cs:line 30
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at aplikacja.Program.Main() in D:\Documents and Settings\ppp_6\My Documents\Visual Studio 2008\Projects\WindowsFormsApplication18\WindowsFormsApplication18\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Message="Call to GetHostEntry failed after 0000 while querying for hostname 'MySQL@local': SocketErrorCode=HostNotFound, ErrorCode=11001, NativeErrorCode=11001."
Source="MySql.Data"
StackTrace:
at MySql.Data.Common.StreamCreator.GetDnsHostEntry(String hostname)
at MySql.Data.Common.StreamCreator.GetHostEntry(String hostname)
at MySql.Data.Common.StreamCreator.GetStream(UInt32 timeout)
at MySql.Data.MySqlClient.NativeDriver.Open()
InnerException: System.Net.Sockets.SocketException
Message="No such host is known"
Source="System"
ErrorCode=11001
NativeErrorCode=11001
StackTrace:
at System.Net.Dns.GetAddrInfo(String name)
at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
at System.Net.Dns.GetHostEntry(String hostNameOrAddress)
at MySql.Data.Common.StreamCreator.GetDnsHostEntry(String hostname)
InnerException:

0

Dziękuję. Niezła strona.

1 użytkowników online, w tym zalogowanych: 0, gości: 1