List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:June 5 2001 9:38pm
Subject:finding the path and filenames for a table
View as plain text  
Hi!

>>>>> "DAVE" == DAVE THOMAS <DAVET@stripped> writes:

DAVE> Hi,
DAVE> I am trying to create a file in the directory that the .frm, .MYI, and .MYD
DAVE> files are located for a particular table. I can create the file by
DAVE> hard-coding the path and specifying a filename but I need to be able to
DAVE> create the file in the folder of the database the table belongs to. How do I
DAVE> get the path that the database files are located? and the database name?


Why would you ever need to store a file in the database directory?
Normally this should not be done as this hampers MySQL ability to
create/destroy databases.

To do this, you must know the database name yourself.

You can get the base of the MySQL data directory with

'mysqladmin variables | grep datadir'

You can get the name of all databases with 'mysqlshow'

To know the directory, just concatenate the data directory with the
datababase name.

Regards,
Monty

Thread
finding the path and filenames for a tableDAVE THOMAS5 Jun
  • Re: finding the path and filenames for a tableJeremy Zawodny5 Jun
  • Re: finding the path and filenames for a tableTimothy Smith5 Jun
  • finding the path and filenames for a tableMichael Widenius5 Jun