Getting Started with MySql

Posted on 2012-04-07
Medium Priority
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.
Question by:trims30
  • 8
  • 5
LVL 81

Expert Comment

ID: 37820465
Download workbench

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
LVL 12

Expert Comment

by:Patricia Siu-Lai Ho
ID: 37821046
Hi Trim,

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

Author Comment

ID: 37821154
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
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.
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

LVL 81

Expert Comment

ID: 37821164
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?

Author Comment

ID: 37821366
See attached image illustrating my procedure in VB.net that causes error when trying to add MySql as new data connection.

Author Comment

ID: 37821559
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
            If SQLConnection.State = ConnectionState.Closed Then
                MsgBox("Successfully connected to MySql")
                MsgBox("Connection is closed")

            End If

        Catch ex As Exception
        End Try
    End Sub

Open in new window

LVL 81

Expert Comment

ID: 37821583
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.

Author Comment

ID: 37821733
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!
LVL 81

Expert Comment

ID: 37821742
Your system is 64, while the driver might be 32 or the reverse.



Author Comment

ID: 37821772
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 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.


Author Comment

ID: 37821789
OK - some progress - Got ODBC to work - had to change port from 3306 to 3307

Now still need the VB.Net Connector to work.

LVL 81

Accepted Solution

arnold earned 800 total points
ID: 37821934
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.

Author Comment

ID: 37822020
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.


Author Closing Comment

ID: 37822023
Thanks again for your suggestions.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

607 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