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=arch...@jab.org
Re: How to change mysql default database directory
Hi, For Linux:*How to change the mysql database location* 1. Create the directory that will be the new datadir. ( example: /home/db ) 2. Change ownership of new folder to the mysql user and group: sudo chown -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 “datadir = /var/lib/mysql” and change it to datadir = /home/db 5. copy the files from the old datadir to the new location. However, make sure that the files named ib_arch_log_00, 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 luckyx_cool_...@yahoo.comwrote: 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. -- 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
Re: How to change mysql default database directory
As Carlos said, mention your required path in the my.ini file and restart the MySQL or move your current datadir to your required path and restart MySQL by mentioning the variable as below in the configuration file. Datadir=path In MySQLD section of your cnf file. Thanks Suresh Kuna MySQL DBA --Original Message-- From: Carlos Proal To: mysql@lists.mysql.com Subject: Re: How to change mysql default database directory Sent: Jan 29, 2010 8:46 AM 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=sureshkumar...@gmail.com Sent from BlackBerry® on Airtel
Re: How to change mysql default database directory
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 carlos.pr...@gmail.com *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_...@yahoo.com
Re: How to change mysql default database directory
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 carlos.pr...@gmail.comwrote: 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 carlos.pr...@gmail.com *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_...@yahoo.com -- Thanks Suresh Kuna MySQL DBA