I just got hold of a new site. It is a game cheats site, so I guess it uses some kind of database to pull out the cheats. The site uses a file where the database information is, and it says: <?php $dbhost = "localhost"; $dbuser = "cheatwir_usr1"; $dbpass = "swiqer55"; $db = "cheatwir_db"; $conn = mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($db, $conn); ?> But I logged in the cpanel, took a look at the databases section, and there is no cheatwir database! Neither is there a cheatwir user, however, the site is working fine. Any idea of how can this be happening?
The owner of the site gave me access to his server. I did a complete backup of the site and moved it to my server. When I tried to see it, I got all kind of msql errors. I then noticed the reference to that database. I checked the owners pages ( which are working fine), and they have the same reference, and I can0t find that database on the owner's server.
Upload a page with this in it, call it say test.php <?php system("mysql_dump -u cheatwir_usr1 cheatwir_db -p swiqer55 >> dump.sql"); echo "done"; ?> Hit up test.php in your browser and then download the dump file once it says done.
I would go with what mkeen said. I have migrated sites this way. It is easy to insert all of the records too! All you need to do is Create the cheatwir_db database, then in a command prompt (telnet session or what ever) type : mysql -u username -p -h hostname-or-IP cheatwir_db < dump.sql JRM
Turns out he had the database on another account. Sloppy as can be... I am having a terrible time cleaning up the mess
It's not to strange. I do that too. One site doesn't have much space so the database is on a different server and user. Yeah I guess it probably is a mess, but I work with what I am given. JRM
I was pulling my hair out trying to find the damn database, only to finally find out that it was on another server
If you use the commands previously shown you don't need to know where the database is, just dump it and put it where you want it to be. JRM
Along the idea of having a database on a different account, if it is the same person working with the database it can be easier to have them under the same account for the ideas of an editor and switching between the database, that way they don't have to use a different username for each database.
I tend to do this too, especially if I have a group of sites using the same back end, and I'm working with cpanel or the like. It's damned annoying to troubleshoot I know. Been there myself. But sometimes it's the quickest alternative. You'll notice the benefits if you're pulling a lot of content from third parties for distribution across a number of sites.. Cheers, JL
hate to admit it but i do it too. i would think admins that host multiple sites on the same server probably do it too. it is just a convenience thing. bad habit to pick up.