Click here to Skip to main content
15,746,079 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a database in phpMyAdmin, and so I want lots of users to be able to connect to my database, but I don't want to use hosting or anything else.

Here is my code to connect to the database:

using System;
using System.Net;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using SchoolJournal.Main;

namespace SchoolJournal.Main
	class DBConnect
		MySqlConnection connection = new MySqlConnection("datasource='localhost';port=3306;username=root;password=;database=schooljournal");

		//Getting connection
		public MySqlConnection getConnection()
			return connection;

		//Create a function to open connection
		public void openConnect()
			if (connection.State == System.Data.ConnectionState.Closed)

		//Create a function to close connection
		public void closeConnect()
			if (connection.State == System.Data.ConnectionState.Open)

And now how do I make it so that users can connect to the database too? Should I rewrite the code, Add components or something else? Can you give me a hint?

What I have tried:

I've tried a lot, and make the connection by IP, and hosts, and a lot more, but I don't succeed. Can you give me a hint?
Updated 2-May-23 5:45am
Richard MacCutchan 2-May-23 12:53pm    
You need to allow all the other users some way of connecting to the system with the database.
Richard Deeming 3-May-23 4:44am    
"I want lots of users to be able to connect to my database, but I don't want to use hosting or anything else"

That's the equivalent of, "I want all my groceries in one bag; but I don't want that bag to be heavy!"

In order for users to connect to your database, it needs to be hosted somewhere that those users can connect to.

NB: Making your database publicly accessible to anyone on the internet is a really bad idea.

1 solution

as far as I know, PHP my admin have setting user can remote access or not.
Like this and this

you have to search this file and do some modification

If you install php xampp on port 80, in example, you can access phpmyadmin on port 80 from another computer using ip or computer name and port.
in example :


or in example your ip is
so, your phpMyAdmin should :

At your xampp there is setting are server can use remotely or not something like this

You should search this file:
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900