Mysql dynamic database location

Mysql dynamic database location

am 18.09.2009 07:12:20 von Manasi Save

Hi All,

Is it possible to change or create any database on a specific location.
I want to specify a db path at runtime.

Thanks in advance.
--
Regards,
Manasi Save
Artificial Machines Pvt Ltd.




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Mysql dynamic database location

am 18.09.2009 10:54:14 von Claudio Nanni - TomTom

--00c09ffb56b9c289ce0473d646dc
Content-Type: text/plain; charset=ISO-8859-1

As far as I know, you can't,
you can do it with symbolic linking but not at run time.
So if you have a clue you can (pre)build empty databases using symbolic
linking and switching to the right one at run time.


Cheers

Claudio Nanni


2009/9/18 Manasi Save

> Hi All,
>
> Is it possible to change or create any database on a specific location.
> I want to specify a db path at runtime.
>
> Thanks in advance.
> --
> Regards,
> Manasi Save
> Artificial Machines Pvt Ltd.
>
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=claudio.nanni@gmail.com
>
>


--
Claudio

--00c09ffb56b9c289ce0473d646dc--

Re: Mysql dynamic database location

am 18.09.2009 11:30:04 von Johan De Meersman

--0016e6d999e1f0b3cb0473d6c6c6
Content-Type: text/plain; charset=ISO-8859-1

You can do that at runtime no problem, you just need to do OS calls for it.

root@soulcake-duck:/var/lib/mysql# *mysqlshow*
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
+--------------------+
root@soulcake-duck:/var/lib/mysql# *mkdir /tmp/remotedb*
root@soulcake-duck:/var/lib/mysql# *chown mysql:mysql /tmp/remotedb*
root@soulcake-duck:/var/lib/mysql# *ln -s /tmp/remotedb/*
root@soulcake-duck:/var/lib/mysql# *mysqlshow*
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
| remotedb |
+--------------------+
root@soulcake-duck:/var/lib/mysql# *mysql remotedb*
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 39
Server version: 5.0.67-0ubuntu6 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> *create table a (a int);*
Query OK, 0 rows affected (0.00 sec)

mysql> *show tables;*
+--------------------+
| Tables_in_remotedb |
+--------------------+
| a |
+--------------------+
1 row in set (0.00 sec)

mysql> Bye
root@soulcake-duck:/var/lib/mysql#




On Fri, Sep 18, 2009 at 10:54 AM, Claudio Nanni
wrote:
> As far as I know, you can't,
> you can do it with symbolic linking but not at run time.
> So if you have a clue you can (pre)build empty databases using symbolic
> linking and switching to the right one at run time.
>
>
> Cheers
>
> Claudio Nanni
>
>
> 2009/9/18 Manasi Save
>
>> Hi All,
>>
>> Is it possible to change or create any database on a specific location.
>> I want to specify a db path at runtime.
>>
>> Thanks in advance.
>> --
>> Regards,
>> Manasi Save
>> Artificial Machines Pvt Ltd.
>>
>>
>>
>>
>> --
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe:
>> http://lists.mysql.com/mysql?unsub=claudio.nanni@gmail.com
>>
>>
>
>
> --
> Claudio
>



--
That which does not kill you was simply not permitted to do so for the
purposes of the plot.

--0016e6d999e1f0b3cb0473d6c6c6--

RE: Mysql dynamic database location

am 18.09.2009 12:39:33 von Andrew Braithwaite

http://dev.mysql.com/doc/refman/5.1/en/server-options.html#o ption_mysqld
_datadir

You can specify the data directory at runtime with the --datadir=3D =
option
to mysqld (mysqld_safe).

Cheers,

A

-----Original Message-----
From: vegivamp@gmail.com [mailto:vegivamp@gmail.com] On Behalf Of Johan
De Meersman
Sent: 18 September 2009 10:30
To: Claudio Nanni
Cc: manasi.save@artificialmachines.com; mysql@lists.mysql.com
Subject: Re: Mysql dynamic database location

You can do that at runtime no problem, you just need to do OS calls for
it.

root@soulcake-duck:/var/lib/mysql# *mysqlshow*
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
+--------------------+
root@soulcake-duck:/var/lib/mysql# *mkdir /tmp/remotedb*
root@soulcake-duck:/var/lib/mysql# *chown mysql:mysql /tmp/remotedb*
root@soulcake-duck:/var/lib/mysql# *ln -s /tmp/remotedb/*
root@soulcake-duck:/var/lib/mysql# *mysqlshow*
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
| remotedb |
+--------------------+
root@soulcake-duck:/var/lib/mysql# *mysql remotedb*
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 39
Server version: 5.0.67-0ubuntu6 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> *create table a (a int);*
Query OK, 0 rows affected (0.00 sec)

mysql> *show tables;*
+--------------------+
| Tables_in_remotedb |
+--------------------+
| a |
+--------------------+
1 row in set (0.00 sec)

mysql> Bye
root@soulcake-duck:/var/lib/mysql#




On Fri, Sep 18, 2009 at 10:54 AM, Claudio Nanni

wrote:
> As far as I know, you can't,
> you can do it with symbolic linking but not at run time.
> So if you have a clue you can (pre)build empty databases using
symbolic
> linking and switching to the right one at run time.
>
>
> Cheers
>
> Claudio Nanni
>
>
> 2009/9/18 Manasi Save
>
>> Hi All,
>>
>> Is it possible to change or create any database on a specific
location.
>> I want to specify a db path at runtime.
>>
>> Thanks in advance.
>> --
>> Regards,
>> Manasi Save
>> Artificial Machines Pvt Ltd.
>>
>>
>>
>>
>> --
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe:
>> http://lists.mysql.com/mysql?unsub=3Dclaudio.nanni@gmail.com
>>
>>
>
>
> --
> Claudio
>



--=20
That which does not kill you was simply not permitted to do so for the
purposes of the plot.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

R: Re: Mysql dynamic database location

am 18.09.2009 12:54:38 von Claudio Nanni - TomTom

--00148531b7665b7e0d0473d7f5be
Content-Type: text/plain; charset=ISO-8859-1

Nice!
Bit are you sure that database is nowhere in the information schema?
And/or innodb tablespace info
Claudio

Il giorno 18 set, 2009 11:30 m., "Johan De Meersman" ha
scritto:

You can do that at runtime no problem, you just need to do OS calls for it.

root@soulcake-duck:/var/lib/mysql# *mysqlshow*
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
+--------------------+
root@soulcake-duck:/var/lib/mysql# *mkdir /tmp/remotedb*
root@soulcake-duck:/var/lib/mysql# *chown mysql:mysql /tmp/remotedb*
root@soulcake-duck:/var/lib/mysql# *ln -s /tmp/remotedb/*
root@soulcake-duck:/var/lib/mysql# *mysqlshow*
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
| remotedb |
+--------------------+
root@soulcake-duck:/var/lib/mysql# *mysql remotedb*
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 39
Server version: 5.0.67-0ubuntu6 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> *create table a (a int);*
Query OK, 0 rows affected (0.00 sec)

mysql> *show tables;*
+--------------------+
| Tables_in_remotedb |
+--------------------+
| a |
+--------------------+
1 row in set (0.00 sec)

mysql> Bye
root@soulcake-duck:/var/lib/mysql#




On Fri, Sep 18, 2009 at 10:54 AM, Claudio Nanni
wrote:
> As far as I know, you can't,
> you can do it with symbolic linking but not at run time.
> So if you have a clue you can (pre)build empty databases using symbolic
> linking and switching to the right one at run time.
>
>
> Cheers
>
> Claudio Nanni
>
>
> 2009/9/18 Manasi Save
>
>> Hi All,
>>
>> Is it possible to change or create any database on a specific location.
>> I want to specify a db path at runtime.
>>
>> Thanks in advance.
>> --
>> Regards,
>> Manasi Save
>> Artificial Machines Pvt Ltd.
>>
>>
>>
>>
>> --
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe:
>> http://lists.mysql.com/mysql?unsub=claudio.nanni@gmail.com
>>
>>
>
>
> --
> Claudio
>



--
That which does not kill you was simply not permitted to do so for the
purposes of the plot.

--00148531b7665b7e0d0473d7f5be--

Re: R: Re: Mysql dynamic database location

am 18.09.2009 13:35:42 von Johan De Meersman

--0016e6d99a523a5aa00473d888f6
Content-Type: text/plain; charset=ISO-8859-1

On Fri, Sep 18, 2009 at 12:54 PM, Claudio Nanni wrote:

> Nice!
> Bit are you sure that database is nowhere in the information schema?
>

didn't think of that :-) Just checked, and the table in remotedb appears and
vanishes in information_schema.tables as you create and remove the symlink.


> And/or innodb tablespace info
>

Heh. If you want InnoDB, this trick will only work if you have
file-per-table set, of course, otherwise all your storage is still gonna be
in the innodata file.




--
That which does not kill you was simply not permitted to do so for the
purposes of the plot.

--0016e6d99a523a5aa00473d888f6--