MySQL Forums
Forum List  »  Newbie

Re: C# windows form project MySQL localhost issue
Posted by: Phillip Ward
Date: July 15, 2025 07:31AM

Quote

MySqlConnection connection = new MySqlConnection("datasource=localhost;port=3306;username=MyUserName;password=MyPassword");

The first element in this connection string is the "host" (a.k.a. computer) on which the MySQL Server is running. In this case, that's "localhost", which means "the same machine" as where my program is running.
To connect to a MySQL Server running on Host_A from any other host, you would change the connection string to be:

"datasource=Host_A;port=3306;username=MyUserName;password=MyPassword"

Quote

I do INSERT and SEARCH ...

You mean insert and select. Don't think I've ever heard of a "search" command in MySQL (or any other SQL dialect). The words we use matter (or, at least, prevent a lot of confusion).


Quote

... phpMyAdmin platform ... should I download this platform?

No. You need to download and install the client-side library that allows your C# application to connect to MySQL. ("MySQL Connector/NET", I think).
Downloading the whole PHPMyAdmin "platform" is like setting up your own bank just to make an ATM withdrawal.

The most useful link I can offer you to start with is at the top of the page and has the word "Documentation" on it.
Documentation is not like the Sun. You can spend many hours looking at it without damaging your eyesight.


Quote

How to create a database with a table there?

To do this in SQL, look for the statements CREATE DATABASE and CREATE TABLE (in the Documentation).

However, you already have PHPMyAdmin, which is a clicky, draggy-droppy User Interface for doing exactly this sort of thing.

Regards, Phill W.

Options: ReplyQuote


Subject
Written By
Posted
Re: C# windows form project MySQL localhost issue
July 15, 2025 07:31AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.