This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-17. For the latest, interactive version please visit https://mariadb.com/kb/.

Connecting to Multiple Local Directories as Datadir?

I am really a noob (on the administration side), and have been working my way through learning various SQL engines over the last 12 months. This spring, I stumbled upon MariaDB and have decided that I like it the most and delved in. I have data that I am working with locally (on an external hard drive) and I was asked to set something similar up for a collegue.

To keep things simple (I thought) I decided to duplicate everything as much as I could down to setting the drive letter the same. I was forced to remove and re-install MariaDB with an instance in order to get it to work. This is ok the first time around as I am creating the DB on the new drive.

However, when it came time to go back and start working on my original creation again I was stumped. The only solution I found was again to remove, and re-install an instance of MariaDB (pointing to a new folder on the external drive) then I adjusted the My.ini file in this folder, and the registry at #HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EEDSQL\ImagePath to show the original folder as the datadir.

Is this the best way to do this, or a reflection of my ignorance, and there is a simpler way that I am just not understanding?

Answer Answered by Vladislav Vaintroub in this comment.

Frankly, I have a problem understanding a question. It was not stated directly, so I'd just guess you wanted to you would like to have datadir in a non-default directory

It is described in the docs

http://kb.askmonty.org/en/installing-mariadb-msi-packages-on-windows/#custom-setup

To use custom datadir, select "Database Instance" in the MSI feature tree during CustomSetup dialog, exactly like on the picture in docs. Select "Browse" to find or create directory where you want to have datadir. Done. Executables will still be in "C:\Program Files\..", data directory is whatever you chose.

There are multiple different ways to do the same. First, you can pass DATADIR as MSI parameter, described in MariaDB MSI installer documentation.

Next, you do not have to use installer to create database instance. You can always create a service using mysql_install_db.exe (https://kb.askmonty.org/en/mysql_install_dbexe/) . You can pass data directory to this utility, as documented.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.