Jump to content


Photo

How to find MYSQL Database location with PHP


  • Please log in to reply
4 replies to this topic

#1 yumico23

yumico23
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 19 April 2006 - 11:14 AM

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

#2 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 19 April 2006 - 11:47 AM

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] ?
wisewood: proven fact, I am both wise, and wooden.

#3 yumico23

yumico23
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 20 April 2006 - 01:39 AM

[!--quoteo(post=366375:date=Apr 19 2006, 06:47 AM:name=wisewood)--][div class=\'quotetop\']QUOTE(wisewood @ Apr 19 2006, 06:47 AM) View Post[/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

#4 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 20 April 2006 - 08:34 AM

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]
wisewood: proven fact, I am both wise, and wooden.

#5 yumico23

yumico23
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 14 June 2006 - 08:46 AM

[!--quoteo(post=366734:date=Apr 20 2006, 03:34 AM:name=wisewood)--][div class=\'quotetop\']QUOTE(wisewood @ Apr 20 2006, 03:34 AM) View Post[/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\" /]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users