Location of MySql files

I have setup mySQL in an openhabian environment. All is working ok.
However, I can’t find where all the tables are stored on the Raspberrypi as I would like to check how much data has been stored.
Any help would be appreciated,

Login as root into mysql

mysql -u root -p

When prompted, supply the MySQL root password. Then from the MySQL prompt, select the data directory:

select @@datadir;


| @@datadir       |
| /var/lib/mysql/ |
1 row in set (0.00 sec)


Thanks Marcel,
I was able to do all the above,
but when i tried to list the contents of the /var/lib/mysql/ directory, permission is denied

You will need to become root first:

sudo -i

Then you can list the contents of the directory:

ls -l /var/lib/mysql/

or to check the diskspace usage:

du -h --max-depth 1 /var/lib/mysql/

When your done being root, simply type:


And you are yourself again :slight_smile: