Jump to content

How to find MYSQL Database location with PHP


yumico23

Recommended Posts

Hi,

I have an Intranet application running on PHP and MySQL.
It was written by another programmer and I can't seem to find the location of the MySQL Database.

Is there PHP syntax that can detect the path directory to the MySQL database.
Thank you

Yuli
Link to comment
Share on other sites

if you look through the php files for where the connection is made, this will give you information such as "localhost", "username", "password".

Have you tried running [a href=\"http://your_server/phpmyadmin\" target=\"_blank\"]http://your_server/phpmyadmin[/a] ?
Link to comment
Share on other sites

[!--quoteo(post=366375:date=Apr 19 2006, 06:47 AM:name=wisewood)--][div class=\'quotetop\']QUOTE(wisewood @ Apr 19 2006, 06:47 AM) [snapback]366375[/snapback][/div][div class=\'quotemain\'][!--quotec--]
if you look through the php files for where the connection is made, this will give you information such as "localhost", "username", "password".

Have you tried running [a href=\"http://your_server/phpmyadmin\" target=\"_blank\"]http://your_server/phpmyadmin[/a] ?
[/quote]

=================================================================

Hi Wisewood,

Thanks a lot for your reply.
Ya I have tried running it [a href=\"http://your_server/phpmyadmin\" target=\"_blank\"]http://your_server/phpmyadmin[/a] and there is only one empty database called "test".
I even do a file search in the whole C Drive and Network but still could not locate it.
The whole scripts of the application can be located but the MYSQL DB could not.
Is there any way / method to locate it? maybe a php script or syntax which I can run at the connection file to detect the location of the database?

Inside the connection files, the hosting is "localhost".
Thank you for you advice Wisewood.

Yuli
Link to comment
Share on other sites

I just found this... which might help you.

If you can find the data/ directory you might get lucky.

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Copying database files
When it comes to backing up MySQL databases, don't ignore the most obvious solution: making copies of the database files themselves.

Because MySQL uses the same table format on different platforms, it's actually possible to copy MySQL table and index files from one platform and use them on another without any difficulties (assuming, of course, that you're using the same version of MySQL on both platforms).

So which files should you copy? MySQL stores all its databases in a special data/ directory, which is further divided into subdirectories, one for each database. Tables and table indexes are represented as files, with the file name equal to the table name plus an extension.

The easiest approach is to just copy the entire data/ directory to backup media, and archive it so that you can get it back at any time. You might want to write a script to automate the copy. You can then pop the script into your crontab so it can run on a daily or weekly basis, depending on how frequently your databases get updated.

If you're moving files between Windows and UNIX platforms, there is one thing that can trip you up. UNIX file names are case-sensitive, while Windows names are not. Therefore, mixed-case MySQL table names are likely to get corrupted when moved between Windows and UNIX (though the data in the tables will be fine). If your SQL code uses these mixed-case table names, it might not work correctly until you check and fix the names and/or the code. For best results, always use lowercase table names, so that you don't encounter this problem.
[/quote]
Link to comment
Share on other sites

  • 1 month later...
[!--quoteo(post=366734:date=Apr 20 2006, 03:34 AM:name=wisewood)--][div class=\'quotetop\']QUOTE(wisewood @ Apr 20 2006, 03:34 AM) [snapback]366734[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I just found this... which might help you.

If you can find the data/ directory you might get lucky.
[/quote]

Hi Wisewood, thank you so much for your findings.
I manage to find how to access to the database now.
[img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.