473,396 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

MySql Connection from .NET

4
Hi,

I recently installed mysql using the connection:

server: localhost
port: 3306
username: root
password: SOMETHING

If I connect through mysql admin, I can see the databases I created.

I'm working on a .NET program that someone else started with the connection parameters:

mysql_Server: localhost
mysql_Port: 3306
mysql_Username: root
mysql_Password: SOMETHINGELSE

'This line connects to the mysqld.exe file in the database\bin directory
Call Shell(sz_InstallPath & sz_MySQLStart & " --skip-innodb", AppWinStyle.Hide)

The connection string connects to the .NET parameters as stated above.

When .NET tries to open the connection. I get this message #28000Access denied for user 'root'@'localhost' (using password: YES).

I'm assuming this is because it's trying to access my original mysql database above.

How do I get .NET to specifically access this database that is in the database\bin and not my normal connection? Do I need a different port? Do I need a "ServerThread"? What is a server thread?

Any help is greatly appreciated.
Aug 4 '07 #1
7 2641
mwasif
802 Expert 512MB
Moved to MySQL forum.
Aug 5 '07 #2
mwasif
802 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. Call Shell(sz_InstallPath & sz_MySQLStart & " --skip-innodb", AppWinStyle.Hide)
What you are trying to do? Connecting to MySQL Server or starting it? If you want to start mysql consider starting mysqld.
Aug 5 '07 #3
kafain
4
I'm trying to open a connection to the mysql database through .NET. I believe .NET is trying to access the database I created instead of the one that is associated with my .NET application.

First the Shell is called:
Call Shell(sz_InstallPath & sz_MySQLStart & " --skip-innodb", AppWinStyle.Hide)

where sz_MySQLStart is equal to "database\bin\mysqld.exe".

Second m_strConnStr is created:
m_strConnStr = String.Format("server={0};user id={1}; password={2}; database={3}; port={4}; pooling=false", mysql_Server, mysql_Username, mysql_Password, mysql_Db, mysql_Port)

Then this code is called:

Try
mysql_Conn = New MySqlConnection(m_strConnStr)
Try
mysql_Conn.Open()
Return True
Catch
Return False
End Try
Catch ex As MySqlException
Return False
End Try

Then I get the error...in the first Catch statement. I could connect before I installed MySql and created my own database with my own connection information. Now I cannot with the above error.
Aug 5 '07 #4
kafain
4
I guess I'm on my own. If anyone is interested, I stopped MySQL services and then I was able to connect to the database through the .NET program. Now I have to figure out how to make .NET go to the other program instead of going to my default database.
Aug 9 '07 #5
I guess I'm on my own. If anyone is interested, I stopped MySQL services and then I was able to connect to the database through the .NET program. Now I have to figure out how to make .NET go to the other program instead of going to my default database.
I think you would find the MySQL .NET connector very useful (if you use VS2005). It manages the connection to the DB quite nicely and integrates in VS2005.

MySQL .NET Connector 5.1
Aug 10 '07 #6
r035198x
13,262 8TB
... Now I have to figure out how to make .NET go to the other program instead of going to my default database.
I'm not sure what you mean by that statement but you specify the database you're conncting to in the connection string.
Aug 10 '07 #7
kafain
4
Hi,

Thanks for the tips. I downloaded Connector/Net, but forgive my newbiness, it doesn't address my question directly. You know how SQL has the Service Manager. MySQL does too and it's "Started" and connected to database A. I have a .NET program with a database in the Debug folder (database B). If I "stop" the instance..and stop msqld.exe (manually)...it connects to database B. Otherwise, it tells me to bite it.

I don't know about threads, but would I have to create one pointing to database B? Do I have to check to see if mysqld is running and shut it down? What do you do to connect to multiple databases? There must be an easy way to tell .NET...hey I want this database and not this one.
Aug 11 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
11
by: DJJ | last post by:
I am using the MySQL ODBC 3.51 driver to link three relatively small MySQL tables to a Microsoft Access 2003 database. I am finding that the data from the MySQL tables takes a hell of a long time...
1
by: zMisc | last post by:
I am looking at using MySQL in my application (currently works with Access and SQL Server 2000). Is it possible to access MySQL database using ADO? What is the connection string for this? ...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
7
by: Ike | last post by:
Let's say I have a MySQL 4.12 database, opened to the internet on 111.111.111.111 allowing all incoming and outgoing ports. I have a username and password setup, which CAN connect to this database,...
5
oll3i
by: oll3i | last post by:
my librarybean package library.ejb; import java.sql.*; import javax.ejb.*; import library.common.*; @Stateless @Remote
3
by: tulika dutta | last post by:
after 8 hrs my MySQL connection with JDBC gets time out. It gives the error java.sql.SQLException: No operations allowed after connection closed.Connection was implicitly closed due to underlying...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.