Issue
I'm completely new to ubuntu and MySQL and I created a new database via:
mysql -u root -p
create database mydb;
Now, in which directory is this database saved and how do I specify where it's saved when I create it?
Solution
In your mysql configuration file (usually /etc/mysql/my.cnf) you should have a datadir property, which is the location where mysql will save its data
Something like:
datadir = /var/lib/mysql
It then creates a subdirectory inside that for each database where it will store the database content (ex: /var/lib/mysql/mydatabase). As far as I know, you can't specify one particular database to be stored outside of datadir.
Answered By - Lepidosteus Answer Checked By - Marilyn (WPSolving Volunteer)