?
Solved

Getting Started with MySql

Posted on 2012-04-07
14
Medium Priority
?
412 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
14 Comments
 
LVL 79

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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 79

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 79

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 79

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 79

Accepted Solution

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
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…

765 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