TablePlus / DBngin

DB Engine
https://dbngin.com
995 stars 19 forks source link

Allow user to select DB location #76

Open MichaelNZ85 opened 2 years ago

MichaelNZ85 commented 2 years ago

I'm working on a MacBook Pro with 256GB storage, so I use an external SSD for most of my projects.

I think it would be a great idea to allow the user to decide where to store the databases, rather than defaulting to /Users/Shared/DBngin.

colonelclick commented 2 years ago

I think you could achieve this for now with a symlink to your external drive. (I imagine this would slow the speed of your db access.)

I believe you can also control this by using my.cnf settings.

comes commented 2 years ago

I have the same workflow as the thread opener, so selecting a storage path would be nice. I'd solve this by figuring out how it currently works.

/Users/Shared/DBngin/mysql/8.0.27/bin/mysqld \
 --user=_mysql \
 --port=3308 \
 --socket=/tmp/mysql_3308.sock \
 --basedir=/Users/Shared/DBngin/mysql/8.0.27 \
 --datadir=/Volumes/storage/mysql/58D6C9FA-4EA6-4E96-9610-AC7175831983 \
 --plugin-dir=/Users/Shared/DBngin/mysql/8.0.27/lib/plugin \
 --log-error=/Volumes/storage/mysql/58D6C9FA-4EA6-4E96-9610-AC7175831983/mysqld.local.err \
 --pid-file=/Volumes/storage/mysql/58D6C9FA-4EA6-4E96-9610-AC7175831983/mysql.pid

The following command is the same that dbngin will run (check it with ps ax|grep mysql while running a test database.

You find a DBEngines.plist file in $HOME/Library/Application Support/com.tinyapp.DBngin/Data. By editing this file, It took no effect on my end. But there are paths and configurations stored. If you restart dbngin after modifying this file, you will recognize that the running status will be changed, and dbngin will notice the pid file (I think)

You will find a different *.plist file in the datadir of a sample database. This file should be named like com.tinyapp.DBngin.mysqld-*.plist. This is also pretty interesting.

for me, as a CLI guy, the first command does the trick.

have fun!

andremacola commented 1 year ago

Symlink won't work. Despite starting the process, it is not possible to connect

workzer commented 11 months ago

Indeed, this feature would be much appreciated. This tool is useless to me without this function. I have defined everything I needed in my my.cnf file and added the desired data directory. I selected it in DBngin and started MySQL. A quick check using ps aux | grep Engines/mysql at / immediately showed that my data directory was overwritten.

huyphams commented 11 months ago

You can hack it by alter the plist info here:

~/Library/Application Support/com.tinyapp.DBngin/Data/DBEngines.plist

It contains the DBPath, LogPath and Pid

stefanofinetti commented 9 months ago

~/Library/Application Support/com.tinyapp.DBngin/Data/DBEngines.plist

Unfortunately this does not solve the problem. I changed the paths in the .plist, but still the service is shown as started but no process is really started and if I hit the refresh button, the service is again in stopped state.

sohaibilyas commented 7 months ago
Screenshot 2024-01-19 at 6 21 24 PM

Now you can select custom db location while creating new db or move files to external ssd and follow this:

I have the same workflow as the thread opener, so selecting a storage path would be nice. I'd solve this by figuring out how it currently works.

/Users/Shared/DBngin/mysql/8.0.27/bin/mysqld \
 --user=_mysql \
 --port=3308 \
 --socket=/tmp/mysql_3308.sock \
 --basedir=/Users/Shared/DBngin/mysql/8.0.27 \
 --datadir=/Volumes/storage/mysql/58D6C9FA-4EA6-4E96-9610-AC7175831983 \
 --plugin-dir=/Users/Shared/DBngin/mysql/8.0.27/lib/plugin \
 --log-error=/Volumes/storage/mysql/58D6C9FA-4EA6-4E96-9610-AC7175831983/mysqld.local.err \
 --pid-file=/Volumes/storage/mysql/58D6C9FA-4EA6-4E96-9610-AC7175831983/mysql.pid

The following command is the same that dbngin will run (check it with ps ax|grep mysql while running a test database.

You find a DBEngines.plist file in $HOME/Library/Application Support/com.tinyapp.DBngin/Data. By editing this file, It took no effect on my end. But there are paths and configurations stored. If you restart dbngin after modifying this file, you will recognize that the running status will be changed, and dbngin will notice the pid file (I think)

You will find a different *.plist file in the datadir of a sample database. This file should be named like com.tinyapp.DBngin.mysqld-*.plist. This is also pretty interesting.

for me, as a CLI guy, the first command does the trick.

have fun!