<commit_before>Import old forum data
=====================

Pre-install
-----------

- Make sure `rcd-nodeca` installed & configured
- Install tools if needed `sudo apt-get install build-essential software-properties-common`.

Install percona mysql server:

```sh
sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
echo "deb http://repo.percona.com/apt "$(lsb_release -sc)" main" | sudo tee /etc/apt/sources.list.d/percona.list
echo "deb-src http://repo.percona.com/apt "$(lsb_release -sc)" main" | sudo tee -a /etc/apt/sources.list.d/percona.list
sudo apt-get update
sudo apt-get install percona-server-server-5.6
```


Prepare data
------------

Unpack:

```sh
mkdir /tmp/extract
lzop -d ./vzdump-openvz-101-*.tar.lzo -c | tar xv -C /tmp/extract
rm -rf /var/lib/mysql
cp -a /tmp/extract/var/lib/mysql /var/lib/mysql
chown mysql:mysql -Rv /var/lib/mysql
ln -s /tmp/extract/var/www/forum.rcdesign.ru/www /tmp/www
#dpkg-reconfigure percona-server-server-5.6
```

Reset mysql permissions:

```sh
service mysql stop
mysqld_safe --skip-grant-tables &
echo "UPDATE mysql.user SET plugin = '' WHERE plugin = 'mysql_old_password'; FLUSH PRIVILEGES;" | mysql
echo "FLUSH PRIVILEGES; SET PASSWORD FOR 'root'@'localhost' = '';" | mysql
kill `cat /var/run/mysqld/mysqld.pid`
service mysql start
```


Import, part 1 (CLI)
--------------------

Drop old content (dev server only):

```sh
mongo nodeca --eval "printjson(db.dropDatabase())"
mongo nodeca-files --eval "printjson(db.dropDatabase())"<commit_msg>Fix mysql password reset instructions<commit_after>Import old forum data
=====================

Pre-install
-----------

- Make sure `rcd-nodeca` installed & configured
- Install tools if needed `sudo apt-get install build-essential software-properties-common`.

Install percona mysql server:

```sh
sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
echo "deb http://repo.percona.com/apt "$(lsb_release -sc)" main" | sudo tee /etc/apt/sources.list.d/percona.list
echo "deb-src http://repo.percona.com/apt "$(lsb_release -sc)" main" | sudo tee -a /etc/apt/sources.list.d/percona.list
sudo apt-get update
sudo apt-get install percona-server-server-5.6
```


Prepare data
------------

Unpack:

```sh
mkdir /tmp/extract
lzop -d ./vzdump-openvz-101-*.tar.lzo -c | tar xv -C /tmp/extract
service mysql stop
# Check mysql does not run and kill if needed
ps ax | grep mysql
kill `cat /var/run/mysqld/mysqld.pid`
rm -rf /var/lib/mysql
cp -a /tmp/extract/var/lib/mysql /var/lib/mysql
chown mysql:mysql -Rv /var/lib/mysql
ln -s /tmp/extract/var/www/forum.rcdesign.ru/www /tmp/www
# Leave empty password field when asked, we reset it in next step
dpkg-reconfigure percona-server-server-5.6
```

Reset mysql permissions:

```sh
service mysql stop
mysqld_safe --skip-grant-tables &
echo "FLUSH PRIVILEGES; SET PASSWORD FOR 'root'@'localhost' = '';" | mysql
kill `cat /var/run/mysqld/mysqld.pid`
service mysql start
```


Import, part 1 (CLI)
--------------------

Drop old content (dev server only):

```sh
mongo nodeca --eval "printjson(db.dropDatabase())"
mongo nodeca-files --eval "printjson(db.dropDatabase())"
{'fraction_non_alphanumeric': 0.1763769500159185, 'fraction_numerical': 0.007640878701050621, 'mean_word_length': 3.527377521613833, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5020630', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1107, 'n_words': 305}