Archive for December, 2009

Bali Kuta beach panorama from inside Centro Mall in 2009

December 23, 2009

Bali Bird Park in 2009

December 22, 2009

Bali Safari & Marine Park in 2009

December 21, 2009

Bali Nusa Dua beach, hot and sunny in 2009

December 16, 2009

Moving the MySQL database directory in Ubuntu

December 16, 2009

Installing MySQL on Ubuntu by default, all data is placed in the directory “/var/lib/mysql“. If you want to move the default directory for any reason, please follow the steps below.

  1. Stop MySQL service.

    ~# sudo /etc/init.d/mysql stop

  2. Copy all existing data into the desired directory and its permissions and attributes.

    ~# sudo cp -p -R /var/lib/mysql /mnt/raid10

  3. Edit the mysql configuration file located in “/etc/mysql/my.cnf“. Find the section [mysqld] and change the contents of variable “datadir = /var/lib/mysql” (default) in accordance with the location of the directory where all data is placed.

    ~# cat /etc/mysql/my.cnf

    [mysqld]
    datadir = /mnt/raid10/mysql

  4. If your Ubuntu server installed “apparmor“, please edit the configuration file in “/etc/apparmor.d/usr.sbin.mysqld” too. Then, find the procedure “/usr/sbin/mysqld“.

    ~# cat /etc/apparmor.d/usr.sbin.mysqld

    /usr/sbin/mysql {

    ..
    ..

    # Find and give commented on the section below.
    # /var/lib/mysql/ r,
    # /var/lib/mysql/** rwk,

    # … then, add the configuration as below.
    /mnt/raid10/mysql/ r,
    /mnt/raid10/mysql/** rwk,

    ..
    ..

    }

  5. Do not forget to save all changes to the configuration files mentioned above and reboot.

In this article, I apply the RAID10 as a storage mode on the MySQL server machine, and MyISAM as database type.