Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
wiki:mysql_persistence_guide [2011/10/07 08:06] bmarkuswiki:mysql_persistence_guide [2015/04/06 08:55] (current) – [MySQL Settings] bmarkus
Line 1: Line 1:
-====== Installing MySQL ======+ARTICLE IS UNDER CONSTRUCTION !!!
  
-**!!! OBSOLATE, UPDATE IN PROGRESS !!!**+====== What is MariaDB ======
  
-First of all you will need to have the MySQL extension installed -- you can do this through the CLI on microcore +MariaDB is an enhanced, drop-in replacement for MySQL.
  
-  tce-load -wi mysql.tcz+====== Installing MariaDB ====== 
 + 
 +First of all you will need to have the MariaDB server and client extensions installed -- you can do this through the CLI 
 + 
 +  tce-load -wi mariadb.tcz mariadb-client.tcz
  
 Or through the GUI app browser in tiny core.  Or through the GUI app browser in tiny core. 
  
-Your MySQL installation will auto generate two items of interest '/etc/my.cnf' and '/usr/local/mysql/data/' +Your MariaDB installation will auto generate two items of interest '/etc/my.cnf' and '/usr/local/mysql/data/' 
  
 You will want to copy both these items to a persistent  area at a later stage, you have a choice of either adding these items to your filetool.lst, or to your persistent storage medium i.e. HDD or USB You will want to copy both these items to a persistent  area at a later stage, you have a choice of either adding these items to your filetool.lst, or to your persistent storage medium i.e. HDD or USB
Line 15: Line 19:
 I will talk you through both.  I will talk you through both. 
  
-====== MySQL Settings ======+====== Start and stop MySQL ====== 
 + 
 +MySQL daemon must be running to work with databases. Use Services menu of Control Panel or following command: 
 + 
 +  /etc/init.d/services/mysql start 
 + 
 +To start it automatically at boot time, add command to /opt/bootlocal.sh 
 +   
 +To stop daemon:   
 + 
 +  /etc/init.d/services/mysql stop 
 +   
 +To stop it automatically add command to /opt/shutdown.sh 
 +   
 + 
 +====== MariaDB Settings ======
 === Root password === === Root password ===
  
Line 72: Line 91:
 With this method you must add the following directories and files to your /opt/.filetool.lst  With this method you must add the following directories and files to your /opt/.filetool.lst 
  
-  /etc/my.cnf 
   /usr/local/mysql/data   /usr/local/mysql/data
      
 This will restore your MySQL settings and DB's on boot.  This will restore your MySQL settings and DB's on boot. 
- 
-Because this restoration occurs after the MySQL extension is loaded, you must reboot the MySQL daemon with the following commands added to /opt/bootlocal.sh 
- 
-  mysqladmin --user=root shutdown 
-  /usr/local/bin/mysqld_multi start 1 
  
 With the filetool method **you must** make sure that before you shutdown, any open connections to the MySQL DBs are closed, otherwise data loss will occur. You can safely shut down the MySQL daemon using the following command; With the filetool method **you must** make sure that before you shutdown, any open connections to the MySQL DBs are closed, otherwise data loss will occur. You can safely shut down the MySQL daemon using the following command;
Line 93: Line 106:
 In this method, you have a much lower chance of data loss, as it does not rely on regular 'doses' of 'sudo filetool.sh -b' to backup your DB's. In this method, you have a much lower chance of data loss, as it does not rely on regular 'doses' of 'sudo filetool.sh -b' to backup your DB's.
  
-First you will want to copy over your my.cnf and mysql directory over to a storage directory. In this case, I will be using the generic hdd -- it could be sda1, hda3sdb e.t.c. +First you will want to copy over your my.cnf and data directory over to a storage directory. In this case, I will be using the generic hdd -- it could be sda1, sda3, e.t.c. 
  
-  cp -fr /usr/local/var/mysql /mnt/hdd/database/mysql +  cp -fr /usr/local/mysql/data /mnt/hdd/database/data 
-  cp -f /usr/local/etc/my.cnf /mnt/hdd/database/my.cnf+  cp -f /etc/my.cnf /mnt/hdd/database/my.cnf
      
 You will then need to add the following commands to /opt/bootlocal.sh, again substituting hdd with your storage device. You will then need to add the following commands to /opt/bootlocal.sh, again substituting hdd with your storage device.
  
-  rm -fr /usr/local/var/mysql +  rm -fr /usr/local/mysql/data 
-  rm -f /usr/local/etc/my.cnf +  rm -f /etc/my.cnf 
-  ln -s /mnt/hdd/database/mysql /usr/local/var/mysql +  ln -s /mnt/hdd/database/data /usr/local/mysql/data 
-  ln -s /mnt/hdd/database/my.cnf /usr/local/etc/my.cnf +  ln -s /mnt/hdd/database/my.cnf /etc/my.cnf 
-  mysqladmin --user=root shutdown +  /etc/init.d/services/mysql start
-  /usr/local/bin/mysqld_multi start 1+
      
 As long as no open, active connections are present on shutdown or crash, no data corruption or loss //should// occur.  As long as no open, active connections are present on shutdown or crash, no data corruption or loss //should// occur. 
Print/export
QR Code
QR Code wiki:mysql_persistence_guide (generated for current page)