HOW TO CHANGE MYSQL DATA DIRECTORY

NOTE: DO NOT perform this action on anything but brand new servers as contamination of InnoDB tables is sure to happen and crash your MySQL InnoDB server

Stop mysql --> service mysql stop

Move MySQL files to the target folder --> # mv /var/lib/mysql/ /targetfolder/

Note: Target folder may be kept on a second hard disk drive

Link the original mysql folders to the new target folder --> ln -s /targetfolder/mysql /var/lib/

Test that it is working --> ls -la /var/lib/mysql

Anticipated outcome to be similar to: lrwxrwxrwx 1 root root 16 Jul  2 04:23 /var/lib/mysql -> /targetfolder/mysql/

Start MySQL back up --> service mysql start


That's it - it should be all good now and can be tested by creating a database in an applicable cPanel and see if the folder for new database populates the target folder ... if so your good to go
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

WHAT WE MANAGE AND FIREWALL FALSE POSITIVES

Relevant to dedicated servers and answering an inquiry from a dedicated server client:Certainly...

ADDING MEMCACHED TO CENTOS 6.5+ AND CENTOS 7+

Step 1: SSH into your server and fire this command yum install memcached.x86_64 Step 2: Next...

APACHE NOBODY ATTACK SCRIPT

The Apache Nobody attack script is useful in stopping those that are victims of Apache Nobody...

BOOT PARTITION FILLING UP

The boot partition can fill up with excess kernels causing the system to crash if the boot...

CLOUDFLARE RAILGUN SERVER INSTALLATION

Installing CloudFlares RailgunThe following tutorial considers that one is already a CloudFlare...

Powered by WHMCompleteSolution