Getting Started with MySql

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.
trims30Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arnoldCommented:
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/
Patricia Siu-Lai HoCommented:
Hi Trim,

You may download xamp or xampp, both running MySQL database.
trims30Author Commented:
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
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

arnoldCommented:
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?
trims30Author Commented:
See attached image illustrating my procedure in VB.net that causes error when trying to add MySql as new data connection.
Capture.JPG
trims30Author Commented:
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
arnoldCommented:
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.
trims30Author Commented:
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!
arnoldCommented:
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
trims30Author Commented:
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!
trims30Author Commented:
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
arnoldCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
trims30Author Commented:
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
trims30Author Commented:
Thanks again for your suggestions.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.