Unable to connect MySQL hosts with MySQL-Front - c#

I want to connect my web project using vs2010 c# with mysql database using MySql-Front, before this I'm using xampp phpMyadmin and I use this query;
"User Id=root;Server=localhost;Database=myDB"
to connect my database but I can't use it when I tried it with MySql-Front. How can I connect my database with MySql-Front? I've never use MySql-Front before, is there any way to do it? thanks

Sorry I already know how to connect my new database, I only need to know new address for my database, so I only need to change the query;
"Server = myServer; Database = myDB; Uid = myUsername; Pwd = myPassword"

Related

how to connect c# windows form with remote mysql database

I want to connect my server pc MySQL database with client pcs. I make configurations in xampp server. PHPMyAdmin shares with fine in other client pcs. but I run my c# form it gets connection name error. this is my connectiondb class in c# form.
public static MySqlConnection conString()
{
MySqlConnection conn = new MySqlConnection(#"server=http://192.168.8.102; userid=root; password=0713; database=pos_system; port=3306");
return conn;
}
I try to run my application using a client pc but it shows this name cannot find. how to fix my error. I also open firewall port 3306.
Your connection string format is not correct for MySql, try something like this:
var con = new MySqlConnection(#"Server=192.168.8.102;Port=3306;Database=pos_system;Uid=root;Pwd=0713;");
For more information check:
https://www.connectionstrings.com/mysql/

MySQL c# Winform - Create new database from dump file (localhost)

I have a problem I need to solve, but not know how exactly. I have a WinForms application (C#) which connects to an online MySQL server - no problem there. In this application I have an option to make database backups (basically I dump this database to a local file on a computer).
I would like to locally "open" this backup on client's computer (to check some old data) - I don't want to make database restore on my server, because database must still be in use for other users. I want to make clean install of MySQL on a local computer and connect to it trough localhost (like I do for testing ), but I do not have physical access to that computer. I can send MySQL installer to my client, but how to go about automatically creating user with password and database from my dump file?
I know how to create a new database if it doesn't exist, but how to do it if it's clean install of MySQL server - no user and password yet.
string connStr = "server=localhost;user=root;port=3306;password=????;";
using (var conn = new MySqlConnection(connStr))
using (var cmd = conn.CreateCommand())
{
conn.Open();
cmd.CommandText = "CREATE DATABASE IF NOT EXISTS `hello`;";
cmd.ExecuteNonQuery();
}
Any help and direction is appreciated.
Regards!
I don't know whether I understand your problem. However,if you install a new Mysql,you can use root user through no database.
Anyway, one thing you need to know,Connect database must has user and password for mysql or sqlserver.
You may need to be more concise description of your problem.

How to connect to SQL server via TCP/IP which is server site using C#?

Everyone.
I've got some questions here..
I'm using C# and trying to connect the other computer which is server site.
The server site has been built a large database and it can be accessed by SQL server manager 2012.
All I'm trying is to read the data in that database then convert to the other file.
The other project test in my computer works(self-connection), but
Here's my sqlconnection string:
string sqlstring = #"Data Source=XXX.XXX.XXX.XXX\SQLEXPRESS,1433;Network Library=DBMSSOCN;Initial Catalog=Database; Integrated Security=False; Connect Timeout=30;User ID=sa;Password=XXXXXXX";
Do I need to add "AttachDbFilename" into there?
or even database path?
AttachDbFilename=""C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\Databasename.mdf"
Because the results are "sa log in failed" or "it couldn't find the database file"..
Is there any good advice? thank you guys!
If you don't really know what arguments the connection string takes you may want to look into the SqlConnectionStringBuilder.
Here is a short code snippet:
SqlConnectionStringBuilder connString = new SqlConnectionStringBuilder();
connString.UserID="sa";
connString.Password = "XXXX";
connString.DataSource = "XXXX"; //if you need to specify a port write
// the portnumber with a ',' behind the address
connString.InitialCatalouge = "MyDatabaseName";
connString.IntegratedSecurity = false; //set this one true if you want to use windows
//authentification instead of sql authentification
string myconnectionstring = connString.ConnectionString;
It is a bad idea to use the super user, consider making a user that has only the privileges you need for your application to minimize security risks.

How to Obtain Connection string for mysql with ubuntu server?

I'm trying to connect to mysql database from C#, but I have no idea how to get the connecttion string, since ubuntu is not like mssql has a visual UI. I have install phpmyadmin on ubuntu server already
it should looks like this
var str="Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword";
var connection = new MySqlConnection(str);
myServerAddress is the Ip of your server
Database is the name of your Databas
Uid is the username of the user that you want to use to authenticate to the database

C# Connecting to remote oracle database. ORA-12154 Could not resolve the connect identifier specified

I have written an application which connects to an Oracle 10g database. From one computer it works fine but from another it errors. Neither computer is the database server.
ORA-12154: TNS:could not resolve the connect identifier specified
The connection string used:
private string = "provider=MSDAORA;Data Source=192.168.1.5/MyInstance;User Id=username;Password=password";
private OleDbDataAdapter oda = oda = new OleDbDataAdapter();
private OleDbConnection oracleConnection = new OleDbConnection(conString.ToString());
However the computer where it works is the database server for another oracle instance!
My application needs to be able to connect to the oracle instance from any computer.
Any ideas?
EDIT: Ive tried this What is the exact format of a connection string for Oracle? but couldnt get any of the options to work.
EDIT: I found a connection string that works.
Provider=OraOLEDB.Oracle; Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.5)(PORT=1521)))(CONNECT_DATA=(SID=MyInstanceID)(SERVER=DEDICATED)));User Id = myusername; Password = mypassword;
Since you can connect trough SqlDeveloper then this supposed to be an issue related to your connection string. I'm not quite sure is there a way to get SqlDeveloper's connection string. Verify your connection string with connectionstrings.com variants.
After alot of playing about the following connection string works for me.
Provider=OraOLEDB.Oracle; Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.5)(PORT=1521)))(CONNECT_DATA=(SID=MyInstanceID)(SERVER=DEDICATED)));User Id = myusername; Password = mypassword;

Categories

Resources