List:General Discussion« Previous MessageNext Message »
From:Andrew Braithwaite Date:September 18 2009 10:39am
Subject:RE: Mysql dynamic database location
View as plain text  
http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld
_datadir

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

Cheers,

A

-----Original Message-----
From: vegivamp@stripped [mailto:vegivamp@stripped] On Behalf Of Johan
De Meersman
Sent: 18 September 2009 10:30
To: Claudio Nanni
Cc: manasi.save@stripped; mysql@stripped
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
<claudio.nanni@stripped>
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 <manasi.save@stripped>
>
>> 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=1
>>
>>
>
>
> --
> Claudio
>



-- 
That which does not kill you was simply not permitted to do so for the
purposes of the plot.
Thread
Mysql dynamic database locationManasi Save18 Sep
  • Re: Mysql dynamic database locationClaudio Nanni18 Sep
    • Re: Mysql dynamic database locationJohan De Meersman18 Sep
      • RE: Mysql dynamic database locationAndrew Braithwaite18 Sep