List:General Discussion« Previous MessageNext Message »
From:prabhat kumar Date:January 29 2010 3:23am
Subject:Re: How to change mysql default database directory
View as plain text  
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_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 <luckyx_cool_boy@stripped>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.
>
>
>
>




-- 
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

Thread
How to change mysql default database directoryLucky Wijaya29 Jan
  • Re: How to change mysql default database directoryCarlos Proal29 Jan
  • Re: How to change mysql default database directoryprabhat kumar29 Jan
Re: How to change mysql default database directorysureshkumarilu29 Jan
Re: How to change mysql default database directoryCarlos Proal29 Jan
  • Re: How to change mysql default database directorySuresh Kuna29 Jan