Issue for q2a import

I’m importing question2answer site and followed below steps. Script is not able to connect to db. anyone please help me on this.

I took ref from vBulletin thread

Docker install Server


  1. Installed discourse using 30 min guide and it worked perfectly fine.
  2. entered app using below commands

cd /var/discourse
./launcher enter app

  1. Installed Mariadb as I was not able to install mysql:

apt-get update && apt-get install libmariadb-dev mariadb-server-10.3

  1. After finishing installing Mariadb check its status and started:

sudo service mysql status
sudo service mysql start

  1. Install dependencies

echo “gem ‘mysql2’, require: false” >> /var/www/discourse/Gemfile
echo “gem ‘php_serialize’, require: false” >> /var/www/discourse/Gemfile
cd /var/www/discourse
su discourse -c ‘bundle install --no-deployment --without test --without development --path vendor/bundle’

  1. Imported database

mysql -uroot -p -e ‘CREATE DATABASE q2adb’
mysql -uroot -p q2adb < q2a-old-db.sql

  1. exported below variables, I dont have any attachments so not exported that variable. also not set password for root user.

export DB_NAME=“q2adb”
export DB_USER=“root”
export DB_PW=""
export TABLE_PREFIX=“qa_”
export TIMEZONE=“America/Los_Angeles”

cd /var/www/discourse
su discourse -c ‘bundle exec ruby script/import_scripts/question2answer.rb’

This is the error I’m getting now after running below command.

/var/www/discourse# su discourse -c ‘bundle exec ruby script/import_scripts/question2answer.rb’
root:@localhost wants q2adb
Loading existing groups…
Loading existing users…
Loading existing categories…
Loading existing posts…
Loading existing topics…

Access denied for user ‘root’@‘localhost’
Cannot connect in to database.

Hostname: localhost
Username: root
database: q2adb

Edit the script or set these environment variables:

export DB_HOST=“localhost”
export DB_NAME=""
export DB_PW=‘password’
export DB_USER=“root”
export TABLE_PREFIX=“qa_”


1 Like

Either you need to set a password or maybe a host name? You installed mysql inside the container?

Can you connect to mysql from the command line and see that there is data there. (Show tables :wink:



I’m inside container.

I tried setting Hostname to localhost, ‘’, ip-171-22-11-150 (this is shown as a hostname when I issue command >hostname) and with actual IP address of server.

I also set password for a root users. I do see tables in db got imported correctly from q2a.

Am I missing any step?

1 Like

discourse experts, please help me on this. I dont know how to proceed at the moment.

Thanks for your help in advance!

The traditional way to incentivize people to give you extra help is to pay money for it, you could post in #marketplace with a budget.

1 Like