D
D
deadspace122022-03-09 07:32:33
MySQL
deadspace12, 2022-03-09 07:32:33

How can I export the MySQL Workbench database so that any computer that I log in to when I start my application can read my database?

I have a database and its a db connection to Studio 2017 C#:
This is one class

string host = "127.0.0.1";
            int port = 3306;
            string database = "auto";
            string username = "root";
            string password = "root";

and another where I apply these lines:
String connString = "Server=" + host + ";Database=" + database
                + ";port=" + port + ";User Id=" + username + ";password=" + password;
            MySqlConnection conn = new MySqlConnection(connString);
            return conn;

The fact is that everything works on my PC, and if I try to run my application from the database on another PC, it cannot find the server and port.
Please tell me how can I connect the database correctly so that from any computer it is possible to read my database in the application?
Thanks in advance!!!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2022-03-09
@Rsa97

In order for the application to access the database on the computer it is running on (localhost, 127.0.0.1), someone must install the MySQL server on this computer and create the necessary database in it.
That is why the SQLite database is most often used as a local single-user database. It does not require a server and for transfer it is enough to copy one file with database data.
If you need all users to work with one common database, then you need to connect not by 127.0.0.1, but by IP, which is available to all computers working with the database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question