ihavprobs
ihavprobs

Reputation: 1492

Mysql - accessing two databases in different locations in same server

Is it possible for a mysql server instance to access one database in hard disk and another database sitting in flash memory? I am running this mysql instance in a linux box where i need to need to maintain one database in flash memory and another in my harddisk. Please help.

Upvotes: 1

Views: 1863

Answers (2)

Tjunkie
Tjunkie

Reputation: 497

a very similar thing can be done using symlinks instead of mount points I think that symlinks are simpler and more flexible

someming like: create database (or 2) cd /some/path/mysql/

there is your DBNAME directory

mv DBNAME /some/other/place/where/you/want/it/DBNAME ln -s /some/other/place/where/you/want/it/DBNAME DBNAME

(doublecheck on permissions that mysql sever has/needs vv. this new symlink)

should work

Upvotes: 0

Marko
Marko

Reputation: 522

The MySQL documentation for create database tells:

A database in MySQL is implemented as a directory containing files that correspond to tables in the database. Because there are no tables in a database when it is initially created, the CREATE DATABASE statement creates only a directory under the MySQL data directory and the db.opt file.

So there is an directory for the database after executing create database. You just need to mount the flash memory as this directory and copy everything into it.

Upvotes: 2

Related Questions