Hi guys and gals,
Not sure if this has been covered before, but if so it's probably buried a million posts back, so here's a
very short "how to" on updating your Pi (in my case I went from a 2B to a 3B), while coming back to life with all of your memories intact.
So first of all you need to dump your databases, so in your existing Pi crack open a terminal and enter this:
Code:
mysqldump --all-databases --user=root --password --master-data > backupdatabase.sql
If you receive this error don't panic:
Code:
$ mysqldump: Error: Binlogging on server not active
Just do this:
Code:
sudo nano /etc/mysql/my.cnf
In the [mysqld] section, under "skip-external-locking" add the following parameter:
Like this:
PHP:
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
log-bin=mysql-bin
#
Then restart mysql server with this command:
Code:
sudo /etc/init.d/mysql restart
Then rerun the mysqldump command again:
Code:
mysqldump --all-databases --user=root --password --master-data > backupdatabase.sql
Backup your my.cnf file:
Code:
sudo cp /etc/mysql/my.cnf my.cnf.bak
Then copy these to your PC with your favourite tool (WinSCP, Filezilla, etc), optionally if you've heavily customised your index.php, style.css, etc (like I had), then dump your entire /www directory to your local machine at the same time.
Follow the instructions courtesy of day_trippr here:
https://www.homebrewtalk.com/showpost.php?p=8040187&postcount=2643 to setup your new Pi (I'd also recommend using a new SD Card with your new Pi so you have an easy rollback solution if something goes wrong), you need a fully working RPints installation first, so don't skip ahead.
Once you have a working RPints setup on your new Pi, then it's basically a reversal of the steps above:
Firstly transfer the 'backupdatabase.sql' and 'my.cnf.bak' to home/pi
Then restore your config file:
Code:
sudo cp my.cnf.bak /etc/mysql/my.cnf
Next restore your databases:
Code:
mysql -u root -p < backupdatabase.sql
Optionally restore your /www directory, but if you do then you'll need to run this command:
Code:
sudo chmod -R 777 /var/www
If you don't do that last step you'll have permissions issues with the files you brought across resulting in pours not being recorded (ask me how I know this).
That's it, I'm now on a RPi3B running Jessie, and my RPi2B previously on Wheezy is now being repurposed for another project.
Reach out if you get stuck on any of the steps, but the good thing about this is if you do get stuck you can simply plug your old RPints Pi back in until you resolve it (you'll just need to do a fresh database dump if you drink anything in the meantime).
Cheers,
Kal