top of page
Search

innodb restore

  • knowledgediary4min
  • Mar 30, 2020
  • 1 min read

Create a new folder:

mkdir /var/lib/mysql2

From R1:

Restore from the /var/lib/mysql folder:

+ The folder which is called the db name (e.g. 'themoder_wordpress')

+ The files: ibdata, ib_logfile0, ib_logfile1


Restore these to /var/lib/mysql2

(Make sure this is mysql2 otherwise you will overwrite the existing mysql instance)


On The Server:

get MySQL to install:

mysql_install_db --datadir=/var/lib/mysql2

Create a my.cnf file in the mysql2 directory:

nano /var/lib/mysql2/my.cnf

and add the following to the file:

[mysqld]
skip-networking
datadir=/var/lib/mysql2/
socket=/var/lib/mysql2/mysql.sock
innodb_data_home_dir=/var/lib/mysql2
innodb_log_group_home_dir=/var/lib/mysql2
skip-grant-tables

[mysql.server]
user=mysql
basedir=/var/lib/mysql2

Update Permissions:

chown -R mysql.mysql /var/lib/mysql2

Run the MySQL Service:

mysqld_safe --defaults-file=/var/lib/mysql2/my.cnf &

Perform a Dump:

mysqldump --socket=/var/lib/mysql2/mysql.sock --databases DB_NAME > /DB_NAME.sql

Import the Dump

DB_NAME < /DB_NAME.sql

Once done, now you can clean up:

Show proccesses and get the PID

ps aux | grep mysql2

Find the Process number and kill it: example:

kill 3408266

Once the Processes are dead, remove the directory:

cd /var/lib/
rm -rf mysql2
 
 
 

Recent Posts

See All
clear script

#!/bin/bash rm -f ./cleanspace.sh bold=$(tput bold) normal=$(tput sgr0) TIMESTAMP=$(date +%d-%m-%Y-%H-%M) LOGFILE="/root/cleardisk-$TIME...

 
 
 
Scripts

#not wordpress site grep shop2vizag.com /var/log/messages | awk '{print $6}' | cut -d: -f1 |sort -n |uniq -c |sort -n #Domains using...

 
 
 
Wordpress basic scripts

Site URL and Home URL SELECT * from wp_options WHERE option_name = 'home' OR option_name = 'siteurl'; update wp_options set option_value...

 
 
 

Comments


  • White Facebook Icon
  • White Twitter Icon
  • White Instagram Icon
  • White YouTube Icon

© 2023 by Knowledge4mind. Proudly created with Wix.com

bottom of page