I have multiple databases (with same schema) used by multiple users. Each user has his own database. Some data of these databases need to be accessible by the public.
First I thought my structure like that: To access the database of user2, I connect to http://user2.mysite.com/public. If I want to see datas of user8, I connect to http://user8.mysite.com/public. It works great, but if I want a SSL I need a wildcard certificate, cheaper than a standard certificate.
Someone told me symbolic link can help me.
So I created another domain name and I would like that when someone connect on mysite.com/user1 he can see database of user1, if I go on mysite.com/user9 I connect to database of user9 to see public datas.
Someone told me I can create a symbolic link (mysite.com/user1) and in it I can put a config file with parameters to connect to the database of user1. I look for this but I can't find anything in docs.
Do you have any idea? Thanks a lot.
Related
Im realy new into this php and android online database thing,So I really ask to somebody to fix my problem.
Im using mysqli_connection and I need my host name for this query ;
$con = mysqli_connect($host,$user,$password,$db);
But the problem is I dont know what is my host my phpMyAdmin site look like this
https://hike.veridyen.com:2083/
and I'm entering my site from this url;
http://dobo.us/atakan/
so what is my host name please ?
If you are using a shared hosting it should be located as follow:
After creating your database, you can find its details, including its
hostname, in your control panel.
Log in to your GoDaddy account.
Click Web Hosting.
Next to the hosting account you want to use, click Manage.
In the Databases area, click MySQL or MSSQL depending on the database type for which you want the host name.
From your list of databases, click Actions next to the database you want to use, and then click Details.
Your database's details displays including its username, host name,
and a link to reset its password.
Instructions above are for GoDaddy, but should give you a general sense of direction.
For SiteGround, use 'localhost'
so I'm creating a website right now where I have a mySQL Database included and I'm displaying some tables of it on my website (with PHP) and it works fine.
But now I'm trying to access the database in another program (Unity) to edit my database.I get the error that the host name wasn't found. Then I tried to ping the ip (given from my hoster 1&1) via the Windows console, but not found. mySQL Workbench doesn't find it either.
I'm wondering if I have to set the database to public or something like that when I want to access it from another program. My Website can access it, probably because it's hosted on the same account.
But I only got a hostname, username, password and database name. The hostname is something like that: "db123456789.db.1and1.com". My domain is of course not this. Do I have to change the host name? On my php website script I used this host name and it works fine.
I'm kind of confused how this works and I can't find any option where I could say like "Hey DB, show yourself to the public".
Any tips? Searched the World Wide Web, but didn't found a hint. Thank you.
I have set up a website with basic HTML/CSS files and would like to take that one step further and implement a database with some PHP to perform simple queries and whatnot.
My problem arose when I noticed while setting up the database and creating the PHP files that connect to the database (on my local machine), I used 'localhost' as an argument for mysql_connect. When I then went to drag and drop my newly created HTML/PHP files along with my database into FileZilla to upload the pages onto my remote server, there was a problem connecting to the database. I have a feeling that it is unhappy with the whole 'localhost' notion - yet I don't know what to change it to.
Currently, I am using this line of PHP code to connect to my remote database (which is all located in FileZilla-land).
$link = mysql_connect('localhost','Tommy','pass')
Also, as another quick question: does my remote server have its own phpMyAdmin page? And if so... how would one go about finding it? =D
I appreciate anyone who is able to assist me in my endeavors.
Thank you!!
Log on to your database server, check the details and obtain the correct server information such as server, username and password.
Once you change the server details you shoudl be ready to rock n roll. Edit post with the host name/server name and we may be able to find it for you.
You'll have a phpMyAdmin page where you're hosting the site. Check the membership area or cPanel.
You are right in that 'localhost' in mysql_connect needs to be different. 'localhost' is a textual representation of a loopback address AFAIK - it connects to the computer it is hosted on. As you have uploaded it to your server (a different computer) it is now trying to connect to a mysql server on the server host, instead of your home computer (which holds all the data).
To make this work you'd need to get your database onto the server you are now working from, OR depending on your home setup, point it to your local database.
Whether your host has MySQL/PHPMyAdmin available to you is another matter altogether. If they have MySQL it is probable but not definite that they have a phpmyadmin interface.
Contacting the server host will yield more information. If they have MySQL, it is probably as simple as getting the required details from them, and 'backing up' your SQL on your local server and uploading it to the new server (easily done with PHPMyAdmin)
TL;DR: The database you are trying to connect to doesn't exist on the server you're connecting from.
In order to create a new database i use Plesk Panel.
I am also using mysql workbench to administer my database instances.
The problem is that when i connect to a database in my server (via workbench) using its unique credentials (database user and passwd) i'm able to see another database instace as well that i have created for another domain in my server via plesk panel.
This second database instance has different credentials from the ones i used to login to the initial database and therefore shouldn't be visible at all.
Does anyone has a clue of how this can happen?
Both are likely linked to your account. I've used a shared hosting environment (Plesk) before where I could see all the database names on the entire server but without the correct credentials I wasn't able to access any of them or view their table structure (I found out because I didn't want others accessing my database).
I would check with your web host for more information.
You don't connect to a database, but you connect to a server. The user you are connecting with has been given privileges to access db objects according to the domain it belongs to. However, if the user you connected with is allowed to enumerate schemas then you will be able to see all defined schemas (= databases) on this server. That doesn't mean you can access it. No reason to worry unless you don't want users to see schemas they have no rights for.
Use the Server Administration section where you can list all users and see what privileges they have for which db object.
First of all thanks a lot for your time and answers.
The reason behind my problem was the actual name of the database instance I had created, which contained the word "test_".
Every database instance created with this text inside its name was visible to every database user when using mysql workbench.
I know it seems a bit strange but I resolved the issue by just changing the name of the db instance.
I need help on creating a basic log-in page and registration page. I only know the basic stuff on php. And my boss told me to use the database he created online (phpmyadmin). So how do I connect the .php file I created to the online database? I have experienced connecting it to a database. But not the one that's online. Any help please? Thank you!
Firstly, PhpMyAdmin is not a database. It is a PHP based database admin tool to ease the management of databases so that you don't need to do the "boring" commandline interface stuff.
Assuming that it's actually just a MySQL database, then you can connect it using mysql_connect().
if you know how to connect it to the local database, it's always the same: you need a server address (localhost, IP or domain), database name, username and password.
read more here:
http://php.net/mysqli
http://php.net/mysql