Over the last few weeks, I've been working to switch my Blog from Textpattern to Hugo, and migrating the content (mainly my posts) to Markdown.
So I decided to dump my posts from the database myself and I'd like to show how.
Find connection params
If you're struggling to find the credentials to your Textpattern database like me, it's best to have a look in the configuration file,
$ cat textpattern/config.php <?php $txpcfg['db'] = 'textpattern'; $txpcfg['user'] = 'txpuser'; $txpcfg['pass'] = '###'; $txpcfg['host'] = 'localhost:3306'; $txpcfg['table_prefix'] = ''; $txpcfg['txpath'] = '/var/www/kleemans.ch/textpattern'; $txpcfg['dbcharset'] = 'utf8'; $txpcfg['siteurl'] = "https://kleemans.ch"; define('PROTOCOL', 'https://'); ?>
Connect to MySQL database
After getting the connection parameters, we can connect to the database:
$ mysql --host=localhost --user=txpuser --password=### Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 500 Server version: 5.7.27-0ubuntu0.16.04.1 (Ubuntu) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. ...
After this we tell MySQL which database we want to use...
... and we can have a look at the tables:
mysql> show tables; +