DBngin icon indicating copy to clipboard operation
DBngin copied to clipboard

Allow user to select DB location

Open MichaelNZ85 opened this issue 2 years ago • 7 comments

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.

MichaelNZ85 avatar Dec 06 '21 09:12 MichaelNZ85

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.

colonelclick avatar Jan 03 '22 22:01 colonelclick

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!

comes avatar Jan 24 '22 07:01 comes

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

andremacola avatar Oct 11 '22 22:10 andremacola

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.

workzer avatar Sep 29 '23 02:09 workzer

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

huyphams avatar Sep 29 '23 02:09 huyphams

~/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.

stefanofinetti avatar Nov 16 '23 11:11 stefanofinetti

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!

sohaibilyas avatar Jan 19 '24 13:01 sohaibilyas