# How to use a bulk import script (e.g., vbulletin.rb)

**URL:** https://meta.discourse.org/t/how-to-use-a-bulk-import-script-e-g-vbulletin-rb/364289
**Category:** Development
**Created:** [April 30, 2025, 8:02pm UTC](https://meta.discourse.org/t/how-to-use-a-bulk-import-script-e-g-vbulletin-rb/364289 "2025-04-30T20:02:14Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [April 30, 2025, 8:02pm UTC](https://meta.discourse.org/t/how-to-use-a-bulk-import-script-e-g-vbulletin-rb/364289/1 "2025-04-30T20:02:14Z")

</div>

I’m doing what appears to be a vbulletin 4 import with some millions of posts. The server I’m doing it on is very slow (users were importing at about 50/minute when I gave up). Back of the envelope math suggests it’ll take 3 months.

So I’ll give bulk import script a chance again. I run normal import scripts in a production container. The same container that was merrily running the standard script can’t access the Discourse database. But the bulk importer wants to access `/var/run/postgresql/.s.PGSQL.5432` rather than use the stuff that production and the regular import script use. So I add this to `web_only.yml`.

```plaintext
  - volume:
      host: /var/discourse/shared/data/postgres_run
      guest: /var/run/postgresql

```

And now I can access postgres.

But then, I can’t access mysql. The same credentials that work in the regular script and that work inside the container from mysql command line don’t work. I get an access denied. I added a `puts` to see that the credentials were all there was expected, and they are, but the code from the regular script:

```plaintext
    @client =
      Mysql2::Client.new(host: DB_HOST, username: DB_USER, password: DB_PW, database: DB_NAME)

```

works just fine, but this

```plaintext
      @client =
        Mysql2::Client.new(
          host: host,
          username: username,
          password: password,
          database: database,
          reconnect: true,
        )

```

Does not. I’ve checked, and

```plaintext
    puts "#{username}:#{password}@#{host}/#{database}"
    puts "PASSWORD: #{password.inspect}"

```

show everything as expected.

Do I need to run this in a development environment? (Why?)

I’m pretty stumped on how the mysql connection works in mysql client and the regular import script, but not in the bulk script. The code looks the same. I don’t see anything about mysql in the `base.rb` scripts.

Or maybe the machine is haunted.

---

_[View the full topic](https://meta.discourse.org/t/how-to-use-a-bulk-import-script-e-g-vbulletin-rb/364289)._
