How to Find Your MySQL Data Directory Containing Your Retain Database

  • 7019203
  • 31-Dec-2014
  • 07-Aug-2017

Environment


Retain
MySQL 5.0 - 5.5

Situation


I need to know where my Retain database is located.  How do I find that when my database system is MySQL 5.0, 5.1, or 5.5?

DISCLAIMER:

This knowledgebase (KB) article is provided for informational purposes only and as a courtesy service to you, our customer. GWAVA Technical Support does not have any database administration (DBA) expertise, nor does it provide DBA services or support. GWAVA is not responsible for the results of implementing any of the concepts contained in this KB article. Implementation of any of the concepts suggested in this KB article shall be done entirely at your own and sole risk, and GWAVA does not provide any kind of warranties whatsoever resulting from your decision of implementing any of the KB article’s concepts. It is up to you to do any research and to ensure yourself that any implementation and setup of any of the KB article’s concepts in your database system is correctly and properly executed. It is imperative that you have backups of your database system and storage directory before making any implementation. If you don’t have any DBA expertise, you should consult with a DBA expert before any implementation of the KB article’s concepts.  Under no circumstances, shall GWAVA, or any of its employees, be liable, in contract, tort, delict or otherwise, whether negligence is provable or not, for any direct, indirect, incidental, special, punitive, consequential or other damages, loss, cost or liability whatsoever that would result from or are related to the implementation of any of the concepts suggested in the KB article.


To the extent permitted by applicable law, GWAVA shall not be liable to you for any special, consequential, direct, indirect or similar damages, including any loss of data, arising out from migrating any type of messages, attachments, database, metadata in your Retain system to another server and/or location.


Resolution


The MySQL "data directory" (a.k.a., "datadir") is the area where the Retain database would be stored.  If you have correctly located the data directory, you'll see a file called "ibdata1" and the parent directory will have a subdirectory called "retain".  MySQL can have multiple data directories, so if you do not see the "retain" subdirectory, then you do not have the correct data directory where the Retain database is being stored.


Linux

1.  Open up MySQL's configuration file:  less /etc/my.cnf

2.
  Search for the term "datadir":  /datadir

3.
  If it exists, it will highlight a line that reads:  datadir = [path]

4.  You can also manually look for that line.  It typically would be found under a section heading of [mysqld] but it does not necessarily have to be found there.

5.  If that line does not exist, then MySQL will default to:  /var/lib/mysql.

Windows
1.  Open up MySQL's configuration file into Notepad:  my.ini

The my.ini will be located in the MySQL program folder, which would be wherever it got installed.  If you did not install MySQL, then use the Windows "search" feature to look for my.ini.  You could also manually search for it by browsing to [drive]:\Program Files\MySQL\MySQL Server 5.5\.

2.  Do a search in Notepad to find the term "datadir".

3.  If it exists, it will highlight a line that reads:  datadir = [path]

4.  You can also manually look for that line.  It typically would be found under a section heading of [mysqld] but it does not necessarily have to be found there.

5.  If that line does not exist, then you'll probably find it under  [drive]:\ProgramData\MySQL\MySQL Server 5.5\data.

NOTE:  The "ProgramData" folder may be hidden.  You may have to type the explicit path into Windows Explorer.

Additional Information

This article was originally published in the GWAVA knowledgebase as article ID 2432.