SOLVED map source dataset to mysql database

fahadshery

Contributor
Joined
Sep 29, 2017
Messages
179
Hi All,

I want to map my dataset located in /mnt/mydataset to an iocage jail called mysql where I installed MySQL database. So that I could take snapshots of the MySQL data. How do I know where the data directory is and how do I map because it says I need to map it to an empty directory in the jail?

thanks
 

fahadshery

Contributor
Joined
Sep 29, 2017
Messages
179
I resolved it by creating the mysql user and Group before installing mysql.

Here are the steps if anyone else come across this task/issue:

Create a dataset in the pool which will hold mysql data directory and will be mapped to the jail storage
  1. Create the Jail from GUI. Stop the jail and Add mount point
    1. Source: your newly created dataset from the pool
    2. Destination: /var/db/mysql (this is where the mysql server will be installed and pointing to for tables and data etc.
  2. Ssh into the jail
  3. Create user-group mysql:
    1. pw group add -n mysql
  4. Create user and add it to the mysql group:
    1. pw user add -n mysql -g mysql -s /usr/local/bin/bash
  5. Change the mounted directory ownership so that mysql could write in this directory:
    1. chown -R mysql:mysql /var/db/mysql/
  6. Now install mysql server:
    1. pkg install mysql80-server
    2. sysrc mysql_enable=yes
    3. service mysql-server start
    4. mysql_secure_installation

if you wish to install phpmyadmin with this then look here.
 
Top