Could you please tell me how can i install MySQL and Apache in different disk on Ubuntu?
try the following Steps :
stop MySQL service and copy /var/lib/mysql to your different disk
than change datadir into in my.cnf
then restart MySQL service.
I hope it helps!
If you haven't done it before, it is better to watch some videos and get some ideas.
However, first of all, you need to update the system.
Then you will need to perform the MySQL installation and follow the instructions.
Once it has been done, try to open MySQL.
To utilize different disks with packages, here's how you can do it by a step-by-step guide for setting it up using a new disk:
1. Install the new disk and prepare it for LVM:
- Run `pvcreate /dev/sdb` to create a physical volume on the entire disk, without partitioning it.
- Create a volume group with `vgcreate vg0 /dev/sdb`, choosing a unique name for your volume group.
2. Create logical volumes for MySQL and Apache:
- Use `lvcreate -n mysql-data -L 50G vg0` to create a logical volume named "mysql-data" with a size of 50GB.
- Use `lvcreate -n apache-data -L 10G vg0` to create a logical volume named "apache-data" with a size of 10GB.
3. Create filesystems on the logical volumes:
- Format the logical volumes with `mkfs.ext4 /dev/vg0/mysql-data` and `mkfs.ext4 /dev/vg0/apache-data`.
4. Mount the directories correctly to match MySQL and Apache configurations:
- Mount the "mysql-data" logical volume to /var/lib/mysql.
- Mount the "apache-data" logical volume to /var/www/.
5. Proceed with installing MySQL and Apache, and update the configuration files:
- Point MySQL to the respective LVM logical volumes: /mysql, /mysql/data, /mysql/logs, and /mysql/binlogs.
- Consider using XFS filesystem for the LVM logical volumes.
Remember to reinitialize the MySQL databases after making the changes, but this process will allow you to effectively utilize different disks with LVM for MySQL and Apache data.