How to change mysql default database directory
How to change mysql default database directory
am 29.01.2010 04:12:50 von Lucky Wijaya
--0-1617391508-1264734770=:77443
Content-Type: text/plain; charset=us-ascii
Hi all,
I've installed MySQL on 320GB Harddisk (partitioned into 3 partitions). I want to know if there's a way to change MySQL default database directory from C: to D:.
Thanks.
--0-1617391508-1264734770=:77443--
Re: How to change mysql default database directory
am 29.01.2010 04:16:31 von Carlos Proal
Absolutely, check for the variable "datadir" on the config file (my.ini
on windows and my.cnf on *nix).
Carlos
On 1/28/2010 9:12 PM, Lucky Wijaya wrote:
> Hi all,
>
> I've installed MySQL on 320GB Harddisk (partitioned into 3 partitions). I want to know if there's a way to change MySQL default database directory from C: to D:.
>
> Thanks.
>
>
>
>
>
--
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: How to change mysql default database directory
am 29.01.2010 04:23:03 von prabhat kumar
--001636e1f85d499d8d047e4527c8
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
Hi,
For Linux:*How to change the mysql database location*
1. Create the directory that will be the new datadir. ( example: /home/d=
b
)
2. Change ownership of new folder to the mysql user and group: sudo chow=
n
-R mysql:mysql /home/db
3. Stop the MySQL database server: sudo /etc/init.d/mysql stop
4. Now you need to edit the /etc/mysql/my.cnf file
1. sudo nano /etc/mysql/my.cnf
2. look for =93datadir =3D /var/lib/mysql=94 and change it to datadir=
=3D
/home/db
5. copy the files from the old datadir to the new location. However, mak=
e
sure that the files named
ib_arch_log_0000000000, ib_logfile0 etc. are not copied to the newer
location.
6. Make sure that the files and directories are owned by mysql user. If
not: sudo chown -R mysql:mysql /home/db/*
7. Restart the MySQL database server: sudo /etc/init.d/mysql start
Hope you find this helpful.
On Fri, Jan 29, 2010 at 8:42 AM, Lucky Wijaya wr=
ote:
> Hi all,
>
> I've installed MySQL on 320GB Harddisk (partitioned into 3 partitions). I
> want to know if there's a way to change MySQL default database directory
> from C: to D:.
>
> Thanks.
>
>
>
>
--=20
Best Regards,
Prabhat Kumar
MySQL DBA
Datavail-India Mumbai
Mobile : 91-9987681929
www.datavail.com
My Blog: http://adminlinux.blogspot.com
My LinkedIn: http://www.linkedin.com/in/profileprabhat
--001636e1f85d499d8d047e4527c8--
Re: How to change mysql default database directory
am 29.01.2010 04:25:38 von sureshkumarilu
QXMgQ2FybG9zIHNhaWQsIG1lbnRpb24geW91ciByZXF1aXJlZCBwYXRoIGlu IHRoZSBteS5pbmkg
ZmlsZSBhbmQgcmVzdGFydCB0aGUgTXlTUUwgb3IgbW92ZSB5b3VyIGN1cnJl bnQgZGF0YWRpciB0
byB5b3VyIHJlcXVpcmVkIHBhdGggYW5kIHJlc3RhcnQgTXlTUUwgYnkgbWVu dGlvbmluZyB0aGUg
dmFyaWFibGUgYXMgYmVsb3cgaW4gdGhlIGNvbmZpZ3VyYXRpb24gZmlsZS4N Cg0KRGF0YWRpcj1w
YXRoDQpJbiBNeVNRTEQgc2VjdGlvbiBvZiB5b3VyIGNuZiBmaWxlLg0KDQpU aGFua3MNClN1cmVz
aCBLdW5hDQpNeVNRTCBEQkENCi0tLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0t LS0NCkZyb206IENh
cmxvcyBQcm9hbA0KVG86IG15c3FsQGxpc3RzLm15c3FsLmNvbQ0KU3ViamVj dDogUmU6IEhvdyB0
byBjaGFuZ2UgbXlzcWwgZGVmYXVsdCBkYXRhYmFzZSBkaXJlY3RvcnkNClNl bnQ6IEphbiAyOSwg
MjAxMCA4OjQ2IEFNDQoNCg0KQWJzb2x1dGVseSwgY2hlY2sgZm9yIHRoZSB2 YXJpYWJsZSAiZGF0
YWRpciIgb24gdGhlIGNvbmZpZyBmaWxlIChteS5pbmkgDQpvbiB3aW5kb3dz IGFuZCBteS5jbmYg
b24gKm5peCkuDQoNCkNhcmxvcw0KDQpPbiAxLzI4LzIwMTAgOToxMiBQTSwg THVja3kgV2lqYXlh
IHdyb3RlOg0KPiBIaSBhbGwsDQo+DQo+IEkndmUgaW5zdGFsbGVkIE15U1FM IG9uIDMyMEdCIEhh
cmRkaXNrIChwYXJ0aXRpb25lZCBpbnRvIDMgcGFydGl0aW9ucykuIEkgd2Fu dCB0byBrbm93IGlm
IHRoZXJlJ3MgYSB3YXkgdG8gY2hhbmdlIE15U1FMIGRlZmF1bHQgZGF0YWJh c2UgZGlyZWN0b3J5
IGZyb20gQzogdG8gRDouDQo+DQo+IFRoYW5rcy4NCj4NCj4NCj4NCj4NCj4g ICAgDQoNCg0KLS0g
DQpNeVNRTCBHZW5lcmFsIE1haWxpbmcgTGlzdA0KRm9yIGxpc3QgYXJjaGl2 ZXM6IGh0dHA6Ly9s
aXN0cy5teXNxbC5jb20vbXlzcWwNClRvIHVuc3Vic2NyaWJlOiAgICBodHRw Oi8vbGlzdHMubXlz
cWwuY29tL215c3FsP3Vuc3ViPXN1cmVzaGt1bWFyaWx1QGdtYWlsLmNvbQ0K DQoNCg0KU2VudCBm
cm9tIEJsYWNrQmVycnmuIG9uIEFpcnRlbA==
Re: How to change mysql default database directory
am 29.01.2010 04:52:50 von Carlos Proal
--------------000506050700070504020409
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
As Suresh and others said, you have to stop the dbms, move to content of
the dir and restart the dbms.
Also, if you have a fresh install, innodb tables will be saved on a
datafile inside the same data dir, but if is not a fresh install you may
have innodb variables (ie. innodb_data_home_dir) in the config file, and
you may need to change those too.
Carlos
On 1/28/2010 9:25 PM, Lucky Wijaya wrote:
> Is that all ? So, if i changed datadir on the config file, whenever i
> create databases mysql will store it on selected directory ? How about
> the created-before database ?
>
> Btw, I'm using Windows.
>
> Thanks in advance.
>
> ------------------------------------------------------------ ------------
> *From:* Carlos Proal
> *To:* mysql@lists.mysql.com
> *Sent:* Fri, January 29, 2010 10:16:31 AM
> *Subject:* Re: How to change mysql default database directory
>
>
> Absolutely, check for the variable "datadir" on the config file (my.ini
> on windows and my.cnf on *nix).
>
> Carlos
>
> On 1/28/2010 9:12 PM, Lucky Wijaya wrote:
> > Hi all,
> >
> > I've installed MySQL on 320GB Harddisk (partitioned into 3
> partitions). I want to know if there's a way to change MySQL default
> database directory from C: to D:.
> >
> > Thanks.
> >
> >
> >
> >
> >
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=luckyx_cool_boy@yahoo.com
>
>
--------------000506050700070504020409--
Re: How to change mysql default database directory
am 29.01.2010 08:57:01 von sureshkumarilu
--001636ed69a80e0344047e48fb7a
Content-Type: text/plain; charset=ISO-8859-1
Carlos - Follow the below steps
1) stop the mysqld service
2) copy the current datadir to your required location ex : D:\\datadirpath
3) Edit the my.ini by placing the option in mysqld section as
datadir=D:\\datadirpath
4) save the my.ini
5) start the mysqld service
It will use your new datadir and the newly created and old databases use the
same datadir
Thanks
Suresh Kuna
MySQL DBA
On Fri, Jan 29, 2010 at 9:22 AM, Carlos Proal wrote:
> As Suresh and others said, you have to stop the dbms, move to content of
> the dir and restart the dbms.
>
> Also, if you have a fresh install, innodb tables will be saved on a
> datafile inside the same data dir, but if is not a fresh install you may
> have innodb variables (ie. innodb_data_home_dir) in the config file, and you
> may need to change those too.
>
> Carlos
>
> On 1/28/2010 9:25 PM, Lucky Wijaya wrote:
>
>> Is that all ? So, if i changed datadir on the config file, whenever i
>> create databases mysql will store it on selected directory ? How about the
>> created-before database ?
>>
>> Btw, I'm using Windows.
>>
>> Thanks in advance.
>>
>> ------------------------------------------------------------ ------------
>> *From:* Carlos Proal
>> *To:* mysql@lists.mysql.com
>> *Sent:* Fri, January 29, 2010 10:16:31 AM
>> *Subject:* Re: How to change mysql default database directory
>>
>>
>>
>> Absolutely, check for the variable "datadir" on the config file (my.ini
>> on windows and my.cnf on *nix).
>>
>> Carlos
>>
>> On 1/28/2010 9:12 PM, Lucky Wijaya wrote:
>> > Hi all,
>> >
>> > I've installed MySQL on 320GB Harddisk (partitioned into 3 partitions).
>> I want to know if there's a way to change MySQL default database directory
>> from C: to D:.
>> >
>> > Thanks.
>> >
>> >
>> >
>> >
>> >
>>
>>
>> --
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe:
>> http://lists.mysql.com/mysql?unsub=luckyx_cool_boy@yahoo.com
>>
>>
>>
>
--
Thanks
Suresh Kuna
MySQL DBA
--001636ed69a80e0344047e48fb7a--