MySQL database location and backup

Hello,

I have come to the point of where I think it is a good idea to create a backup of my databases from mysql. However, I am unable to locate them on my yun AND have no clue as to how to do the backup.

I read lots of posts stating the databse should be in the /mnt/sda1/arduino/www folder but mine is empty. So the question is, where does it reside? Can I check a config file somewhere to locate it? I have used WinSCP to search my yun for the database-name I gave it, but no luck. I do know that the databases exist as I can check their content via mysql -u username -p and go to the applicable database.

Second, if I locate it, is it just a matter of copying databasename.db to my backup station or is there a more specific way of backing up a db like copying a folder? And if I need to restore something, do I do just the opposite?

Thanks for the help!

You are running mysql-server on the Yun?

If so, the database location can be looked up like this:
FTP into the Yun and download the mysql conf file: /etc/my.conf
There will be a line that tells mysql where to locate its data:
"datadir = /mnt/data/mysql/"

Mine is located on the SD card and so reads:

"datadir = /mnt/sda1/data/mysql/"

If yours is not on the SD card, it would be advisable to move it because of the limited read/writes and space on the Yun itself.

You could probably back up the physical files, but it might be a better idea to actually export the SQL database. I use HeidiSQL to log into my database from a computer to view and manage it. You can export/import SQL files to backup or restore information.

To access the mysql database from outside the Yun, you would also need to change the bind address to let it listen for access outside of itself:
bind-address = 127.0.0.1 --> bind-address = 0.0.0.0 (also in my.conf)

I'll have a look. Thanks!