Click to See Complete Forum and Search --> : MySQL Connection Problem


techie_vb
January 30th, 2006, 01:09 AM
Hi,

Iam a newbie to MySQL.Iam using VB Express Edition 2005 for User Interface.

Today I have downloaded
(1) MySQL 5.0.18 - win 32
(2) MySQL connector - net-1.0.7
(3) MySQL connector-odbc-3.51.12 -win 32
(4) MySQL QueryBrowser - 1.1.19 -win 32

Hope I have downloaded the required software and tools to work with MySQL database.

I don't know the procedure to create DATABASE(Table) in MySql.

After Downloading the above mentioned Software,From the START Menu I could see

(i) MySQL Server 5.0---> (MySQL Command Line Client , MySQL Manual , MySQL Server Instance Configuration)
(ii) MySQL Connector Net 1.0.7 --> (ChangeLog, Documentation)


I couldn't log-in to my Query Browser -
The following Error is displayed.

***
Could not connect to the specified instance.

MySQL Error Number 1045
Access denied for user 'NewUser'@'localhost'(using password: YES )

If you want to check the network connection,Please click Ping button.

***
_____________________________________________________________

I have used the following to enter in to the Query Browser

ServerHost - localhost
UserName - NewUser
Password - newdb
Port - 3306

_______________________________________________________________


Now I'm just trying to Connect MySql through VB 2005(via button Click Event).

****************************

Imports MySql.Data.MySqlClient

Public Class Form1

Private MySqlConn As New MySqlConnection

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

MsgBox("Trying to Connect MySQL")


MySqlConn = New MySqlConnection()


MySqlConn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;Port=3306;DATABASE=mydatabase;USER=myUsername;PASSWORD=myPassword;OPTION=3;"

MySqlConn.Open()

MySqlConn.Close()
MySqlConn = Nothing

MsgBox("Connected MySQL ")

End Sub

***********************************************

I'm getting ArgumentException in Connection String.
Keyword not supported.
Parameter name: option

Hope someone could help me to solve the same.

Thanks in Advance!!!

ITGURU
January 31st, 2006, 12:08 AM
Dear techie_vb,

The problem lies in your Connection string declaration, please check the exact format of Connection string you can use for MySQL Database on following link:

Connection String Format (http://www.dofactory.com/Connect/Connect.aspx#mysql)

Another Connection string link (http://www.connectionstrings.com/)

If you check the second link you will find there is no OPTION attribute in Connection string.

So, it will be better write connection string as per provide detail in above links.