Solved

Getting Started with MySql

Posted on 2012-04-07
14
408 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 77

Expert Comment

by:arnold
ID: 37820465
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
ID: 37821046
Hi Trim,

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

Author Comment

by:trims30
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 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 77

Expert Comment

by:arnold
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?
0
 

Author Comment

by:trims30
ID: 37821366
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
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
        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 77

Expert Comment

by:arnold
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.
0
 

Author Comment

by:trims30
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!
0
 
LVL 77

Expert Comment

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

Lee
0
 
LVL 77

Accepted Solution

by:
arnold earned 200 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.
0
 

Author Comment

by:trims30
ID: 37822020
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
ID: 37822023
Thanks again for your suggestions.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

840 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