Solved

Getting Started with MySql

Posted on 2012-04-07
14
397 Views
Last Modified: 2012-04-08
Would like some assistance in getting started with MySql.
My experience has been with MsAccess - Sql, vb6-ADO, Asp/Asp.net
But never worked with a SQL Server or created a SQL Database before.

I have downloaded and installed MySql for Windows thus far.
Need help with the following:
1. Starting the Server
2. Creating a database -
3. Adding a sample table
4. Connecting to Database and Table in VB.Net

I need someone to get me started.  - have looked at tutorials but they assume you've got a server running and you're using a command line program to execute SQL statements.

Any help is sure appreciated.
0
Comment
Question by:trims30
  • 8
  • 5
14 Comments
 
LVL 76

Expert Comment

by:arnold
Comment Utility
Download workbench
http://dev.mysql.com/downloads/workbench/5.2.html

This is a graphical tool to manage your MySQL server. Use the administrator portion which will let you create databases/schemas and then tables and defining the columns of the tables, indexes, etc.

For vb.net you need to download and install the odbc and/or .net connector
http://dev.mysql.com/downloads/connector/
0
 
LVL 12

Expert Comment

by:Patricia Siu-Lai Ho
Comment Utility
Hi Trim,

You may download xamp or xampp, both running MySQL database.
0
 

Author Comment

by:trims30
Comment Utility
1. Am Able to use Workbench 5.2 to create a new EER model of my Schema.
How do I convert that EER model to a database?

Am able to create database using Command Lines but would like to use Workbench.

2. Having trouble with the .net Connector - in Visual Studio when attempting to Add Connection.
I specify MySQL as Data Source,
Enter Server Name: LOCALHOST  also tried 127.0.0.1
Enter User Name:  root
Entered password: *******
Entered Database Name: MytestDatabase
Click OK - get message to enter Username and password for Localhost:3306
What do I enter here? - tried root with my password and get message "Unable to connect to any of the specified MYSQL hosts"

I'm making some progress but not very fast.  More help needed.
Thanks
0
 
LVL 76

Expert Comment

by:arnold
Comment Utility
You would need to use the MySQL query portion of the workbench, then you would use the eer to either export the SQL commands for creating the eer into the clipboard and then paste that into the MySQL query interface and execute.
Usually right click on table and see the options there that will output the SQL syntax for creating.

What is the error that you get during the attempt with visual studio?
0
 

Author Comment

by:trims30
Comment Utility
See attached image illustrating my procedure in VB.net that causes error when trying to add MySql as new data connection.
Capture.JPG
0
 

Author Comment

by:trims30
Comment Utility
Also tried the following in VB.Net after adding reference to MySql.  It gives me an exception error - see attached Image

Imports MySql.Data.MySqlClient

Public Class Form1
    Dim ServerString As String = "Server=localhost;User ID=root;password=trims30;database=trimstestdata"
    Dim SQLConnection As MySqlConnection = New MySqlConnection

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SQLConnection.ConnectionString = ServerString
        Try
            If SQLConnection.State = ConnectionState.Closed Then
                SQLConnection.Open()
                MsgBox("Successfully connected to MySql")
            Else
                SQLConnection.Close()
                MsgBox("Connection is closed")

            End If

        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub

Open in new window


.
Capture1.JPG
0
 
LVL 76

Expert Comment

by:arnold
Comment Utility
Install the MySQL odbc connector
Setup using odbctab a Dsn connection to the MySQL and confirm that it works.
Alternatively, try using the servername versus localhost In the event the issue is that the way rights were granted to connection to localhost versus servername is the issue.
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 

Author Comment

by:trims30
Comment Utility
Tried that - get error below using ODBC/MsQuery:

"The specified DSN contains an architecture mismatch between the driver and application."

with my luck I had better keep away from Las Vegas!
0
 
LVL 76

Expert Comment

by:arnold
Comment Utility
Your system is 64, while the driver might be 32 or the reverse.

Odbcad32.exe

http://msdn.microsoft.com/en-us/library/windows/desktop/ms712362(v=vs.85).aspx
0
 

Author Comment

by:trims30
Comment Utility
Arnold:
Thanks for your patience with me.

Yes - just installed 32Bit ODBC Connector - my machine is Win7 64 and am using 32bit Excel/MsQuery.

So, with 32bit ODBC I now get error...

"Can't connect to MYSQL server on 'localhost' (10061)"

Also tried 127.0.0.1 rather than LocalHost.

Am able to use MySql 5.5 Command Line Client with no problem so part of it is working - just can't get the darn connectors to work - either VB.Net or ODBC.

Grrr!
0
 

Author Comment

by:trims30
Comment Utility
OK - some progress - Got ODBC to work - had to change port from 3306 to 3307

Now still need the VB.Net Connector to work.

Lee
0
 
LVL 76

Accepted Solution

by:
arnold earned 200 total points
Comment Utility
You would likely have to use localhost:3307 as the host:port in the connection string or port=3307not sure which ones the correct one for vb.net.
Could it be that it was not listening on port 3306 and the change you made to 3307 merely enabled the tcp/ip listening.
0
 

Author Comment

by:trims30
Comment Utility
Arnold:
Thanks for spending the time to work with me.  Adding Port=3307 to connection string did the trick.

Dim ServerString As String = "Server=localhost;port=3307;User ID=root;password=trims30;database=trimstestdata"

I know nothing about ports but will do some reading on the subject and do some testing on other databases with MySql.

Even though you didn't have specific answers to my questions you led me in a direction whereby I was able to get my project off the ground.  It's always great to have someone to discuss issues with.  Hope to work with you again in the future.

Regards,
Lee
0
 

Author Closing Comment

by:trims30
Comment Utility
Thanks again for your suggestions.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Creating and Managing Databases with phpMyAdmin in cPanel.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now