How to attach mysql database when creating a setup? - mysql

I am using vb.net and xampp for creating my project. I want to attach the database on my setup file so that i wont have to install xampp on other computer just to make it work. Do i have to install database server?

Do i have to install database server?
Only on the machine where MySQL will run, not on every machine that runs your vb.net application. Shared data residing in a shared MySQL database is the point of using database technology.
You will need to provide a connection string to every user or every machine that runs your vb.net application. That connection string must specify these items of information
the hostname or ip address of the machine running MySQL
the name of the database on MySQL used for your application
the username of the user account on MySQL with access to the database
the password for the user account.
Your connection string will look something like this:
Server=MySQLHost;Database=myDataBase;Uid=username;Pwd=password;
For example, if your server is on 192.168.1.220, the database name is saldieApp, the MySQL username is ourMySQL, and the shared password is dontTellMom, your connection string is
Server=192.168.1.220;Database=saldieApp;Uid=ourMySQL;Pwd=dontTellMom;
Your vb.net program will do something like this to connect to MySQL.
Dim conn as MySQLConnection
conn = New MySqlConnection()
conn.ConnectionString = "Server=MySQLHost;Database=myDataBase;Uid=username;Pwd=password;"
conn.Open()
The trick for installing a company-wide application using a shared database is to distribute the appropriate connection string to each user. You can put that connection string in your setup file. Or you can do something more secure that doesn't require you to store the password in your setup file.

Related

LDAP Connection String for Teradata in SSRS

I am setting up the Reporting Servers for a SQL server that I am migrating and one of the data sources connects to Teradata. I am able to connect fine using the DB username and password but when I try to use Windows/LDAP it fails to connect. My company requires it being set up with the LDAP login.
The current connection string I am using is Data Source= datasource.com; Database=db1,db2
Is there a different connection string I can use to enable LDAP within the SSRS?
Thank you in advance.

How to connect to MySql via LDAP (without putting a username and password)

I want to connect to a MySql server using the following example of a connection string:
"Server=server_name;Port=3306;database=db_name"
My code is accessing from a container using the username that runs the container/pod (Kubernetes) itself.
Meaning that I don't want to use this connection string example:
"Server=server_name;Port=3306;database=db_name;user=user_name;password=my_pwd"
All I need is to connect with the user running the service (this user is an Active Directory user).
How can I do that?

mysql connection string over domain

i made application using VB.Net and everything is working fine on my PC at home, i wanted to start using it at my work network i installed mysql community on windows 2012 server with successful connection and that server is under domain and i logged in as admin
when i setup my application on the other machines of users i got message of unable to connect with mysql.. my understanding of this is the problem with my connection string the connection string i used is
if i try the connection string on the server machine it will work and connect
Dim conn As New MySqlConnection("server=localhost;userid=root;password=mmm123;database=dam;sslMode=none")
OR
Dim conn As New MySqlConnection("server=127.0.0.1;userid=root;password=mmm123;database=dam;sslMode=none")
but on user machine it will not it will give unable message and i even tried using ip address but still the same problem
Dim conn As New MySqlConnection("server=xx.xx.xx.xx;userid=root;password=mmm123;database=dam;sslMode=none")
can you please lead me from where i should start with
thank you in advance

Unable to connect to any of the specified mysql hosts VB.NET MySQL

I need to develop Client/Server Application in VB.Net, Database is MySQL.
So, Now I am doing connection testing. I created Connection string and it connected successfully in Server. Its working perfect. My Connection string is
Dim myConnectionString As String =
"SERVER=192.168.2.193;PORT=3306;UID=root;PASSWORD=globe;DATABASE=firstdb;"
But When I am trying to access from Client, it shows error : Unable to connect to any of the specified MySQL hosts.
Please help me to clear this issue.
Thanks.

Connecting To Local mySql Database

Currently I am connecting to an online mySql database. I would like to switch it to a mySql database on my local hard drive and am having problems with the syntax. Unlike the online one I have no UserID or Password. Any help is appreciated. Thank you.
(mysql_real_connect (conn,"urlock.db.5513143.hostedresource.com","urlock","passxxx","useridxxx",0,NULL,0) !=0);
tried this:
(mysql_real_connect(conn,"c:\urlock.db","urlock","","",0,NULL,0) !=0);
didn't work.
That second parameter needs to be a host which represents a network connection. It cannot be an absolute file reference like you might do with MS Access files. So, you need to install MySQL5.X on your system as a service. If you've done this, verify it by either looking for an open port of 3306 (default) via a 'netstat -an' command or simply look in your services for 'MySQL ....'.
If not, download it here:
http://dev.mysql.com/downloads/mysql/
Once you get this you will be able to import the this database locally and be able to access it very similar to the online version. i.e. (mysql_real_connect(conn,"localhost","urlock","someuser","somepass",0,NULL,0) !=0);
Importing/exporting can be tricky but to point you in the right direction look into the mysqldump command.
I believe the second parameter should be the host. If it is a local mySQL, the
host is localhost.
The default username is usually 'root'.
Try this:
(mysql_real_connect(conn,"localhost","urlock","","root",0,NULL,0) !=0);
Most (if not all) installations of MySQL should have default accounts. There should at least be a root account. http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html
You'll need a CONNECTIONSTRING
SqlConnection con = new SqlConnection(connectionString);
con.Open();
If you add your database in visual studio under Dataconnections, you can see the connection string under properties
ADDED:
If its an sqllite db, you need to use an SQLCeConneciton
private static string connectionString = #"Data Source=path/to/the/database/db.sdf";
private static SqlCeConnection con = new SqlCeConnection(connectionString);