LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Query against MySQL to tell where the files for the tables are. (http://www.linuxquestions.org/questions/programming-9/query-against-mysql-to-tell-where-the-files-for-the-tables-are-4175459812/)

Rupadhya 04-27-2013 02:55 PM

Query against MySQL to tell where the files for the tables are.
 
Hello all,

I used to know a query in Oracle that did this, but I would like one in MySQL.

What I would like is this. I would like a query that told me the location and the names of the files where actual data in a mysql db stored on a linux server.

My plan is this. Find out where the data is stored, bring down the MySQLd and then back up the data files. In case of catastophic failure, I hope to be able to restore the data.

Regards,

Raj Upadhyaya

Habitual 04-27-2013 03:04 PM

no need to interrogate mysql with this task...
Code:

grep -iw datadir /etc/my.cnf

Rupadhya 04-27-2013 07:05 PM

Cool! Should I back up everything in this directory? Is there a way I can keep the storage some where else (I think it is in the root file system for my server, which is pretty small.)

- Raj Upadhyaya

chrism01 04-28-2013 08:14 AM

Use the mysqldump cmd; it'll give you a consistent backup without having to shutdown MySQL, and you can choose exactly what you want backed-up.
http://www.day32.com/MySQL/
https://dev.mysql.com/doc/refman/5.1...-recovery.html


All times are GMT -5. The time now is 01:34 AM.