Migrate a MyBB forum to Discourse

Hi again - I can get up to this point in the tutorial

bundle install

and for me this falls over with error

'Don’t run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Your Gemfile has no gem server sources. If you need gems that are not already on
your machine, add a line like this to your Gemfile:
source ‘https://rubygems.org
Could not find gem ‘mysql2’ in any of the gem sources listed in your Gemfile.

Any suggestions?

Unfortunately I know nothing about ruby or linux or gemfiles and so am just literally plodding though various discourse cli setup tasks as the tutorials instruct by cutting and pasting commands via PuTTy, without any kind of understanding.

I am running Ubuntu and Discourse in a Digital Oceans Droplet, if that helps?

Also, I see a subsequent reference to pasting database export commands into ‘shell’ . For practical purposes is my current PuTTy connection to the server = ‘shell’, or is some other interface/console involved?

OK, in partial answer to my own question, random thrashing around on forums suggests

$ sudo apt-get install libmysqlclient-dev

will then allow mysql2 gem to install (whatever that is) - ignoring the warning about not doing this as root.

Getting past that and to the next step - typing

$ bundle exec rails db:drop

gives another error::::

bundler: failed to load command: rails (/usr/local/bin/rails)
Gem::Exception: can’t find executable rails for gem railties. railties is not currently included in the bundle, perhaps you meant to add it to your Gemfile?

Checking in /usr/local/bin/ and I can see a file named ‘rails’ is definitely there.

Typing $ sudo gem or $ gem install rails or $ sudo gem install rails does not help (per various suggestions stumbled across for this error).

Have even gone back and installed Ruby on Rails from scratch to try and ensure all normal dependencies are present How To Install Ruby on Rails with rbenv on Ubuntu 18.04 | DigitalOcean -and no improvement - whether I use version 2.51 or 2.61.

Well out of my depth here…

Well I can say categorically that following this guide as written does NOT work for anyone following the official steps for setting up local Dev environment under WSL2 installation of Ubuntu-18.04 under Windows 10 - at almost every step there will be some dependency missing or connection refused error or similar.

With a lot of pain and online research, I have managed to get up to the command:

$ bundle exec ruby script/import_scripts/mybb.rb

but this generates response:

mysql2/client.rb:90:in `connect’: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) (Mysql2::Error::ConnectionError)

This has been a brick wall - nothing I have found by searching online seems to offers a working solution to this

How do I solve this and progress to the next step? Any help much appreciated!

1 Like

Hi, how can I upload database on my DigitalOcean droplet? I used installation 1click of DigitalOcean to install Discourse (Ubuntu).
On my PC I have Windows 10 Home 18362 build version.

Then I have installed Mysql but now I don’t know how “physically” upload Mybb database on the server. Isn’t there phpmyadmin where you can easily import the database? :frowning:

1 Like

You need to upload the file using scp or similar. Then Something like

  mysql - u user - p password database < filename..sql

I’m stuck :frowning:

1 Like

This guide should be updated to be compatible with running the import inside a Docker install instead of using a local development machine.


Really looking forward for the guide to run on a docker based environment :slight_smile:


I gave up on DIY in the end and got a developer on the job - referring him to all the great suggestions on this forum (which helped!) - and I believe he achieved this directly on my live Digital Ocean droplet rather than in a separate development environment (so I could review things easily as he worked - users were not impacted as forum not officially live yet.) - in other words I think it is possible.

After a few iterations, results are now pretty good - all the MyCode and strange character issues resolved, translated my MyBB post prefixes as Discourse tags, custom multi-select user profile fields imported successfully.

If he is willing, I will ask him to share any tweaks to standard import script, and other techniques used here.


In case it helps anyone, the developer @rahilqf I engaged completed the project including translation of custom MyBB user fields into Discourse custom user fields (which depends on having the multi-select-user-field plugin installed), MyBB post prefixes translated into Discourse tags, and stripping out of nearly all redundant MyCode tags from MyBB post text.

His customized import script version is shared here - Custom MyBB to Discourse Import Script.

He also successfully merged in a Yahoo Groups Mbox archive, using the standard Yahoo import script - though with this attachments seemed not to translate. In my case that was not a major problem.


I’m converting users, post, topics etc from Mybb database!

I have followed this guide: Beginners Guide to Install Discourse on Ubuntu for Development

but http://localhost:3000/ or http://forum.omaggieconcorsi.com:3000/ don’t work

Anyway, the program is converting something, but I don’t know where I can then export the data.
Discourse I can’t see it with http://forum.omaggieconcorsi.com:3000/ or http://localhost:3000/ so how can I at least export the database with posts, users etc. from the old Mybb forum and then import it on new Discourse instance?


Did you follow those instructions on the same computer where you’re running the web browser?

1 Like

Yes, always the same computer

Ok, I have followed this guide on Ubuntu 18.04 “real” SO installed on PC and localhost:3000 works!

But now I have problem with database Mysql :frowning: Sorry…

I type:

debby@debby-MS-7721: mysql -u root
ERROR 1698 (28000): Access denied for user 'root'@'localhost'


EDIT: I have added password to root with ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';

And in DB_PW I have written the password of root user.

… and now it’s creating users!!

Cross your fingers for me, is it finally the right time after weeks of testing??

1 Like

I’m trying to import the database from MyBB to discourse. Like @Paul_King I can’t get it to work on my DigitalOcean server. I keep getting all kinds of errors as I follow this guide.

I’m stuck trying to execute the command

$ bundle exec rails db:drop
bundler: command not found: rails
Install missing gem executables with `bundle install`

Bundle install says it’s complete

$ bundle install
Your Gemfile lists the gem mysql2 (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Using bundler 1.16.1
Using mysql2 0.4.10
Bundle complete! 2 Gemfile dependencies, 2 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

Trying to manually install rails results in this:

$ gem install rails
Building native extensions. This could take a while...
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.5.0/gems/racc-1.5.2/ext/racc/cparse
/usr/bin/ruby2.5 -r ./siteconf20210110-8155-1ms05r3.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.5.0/gems/racc-1.5.2 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/racc-1.5.2/gem_make.out

This is extremely frustrating.

Left this post open and managed to install rails. Then had a million other errors and managed to fix them. Errors. On. Every. Single. Step.

Never before I have felt such pure hatred for software. Why is ruby like this? This is a nightmare. I’m now stuck with this error:

$ bundle exec rails db:drop
Traceback (most recent call last):
        1: from /usr/local/bin/bundle:23:in `<main>'
/usr/local/bin/bundle:23:in `load': cannot load such file -- /usr/share/rubygems-integration/all/gems/bundler-1.16.1/exe/bundle (LoadError)

Can someone help?

1 Like

Not useful, but I encountered much the same brick walls, both when attempting to set up in a local development environment (to generate a Discourse database file/backup) and directly in my Digital Ocean Droplet. Finally decided after wasting tens of hours that life is too short and got a developer from Fiverr (who took weeks to figure it out, but got there).
I suspect the incentives just aren’t there for anyone to make the process easier.

Best of luck - and I hope if you finally do crack it, you will leave a trail of breadcrumbs on here for others to follow!

1 Like

How did you install rails? Did you usual one of the development guides? (like Beginners Guide to Install Discourse on Ubuntu for Development)

There are some howto documents for running the install script inside the production container (what I usually do), so you might use one of those for a guide.

That’s unfortunate you had to resort to hiring a developer for something like this. Maybe the guide is outdated?

Yeah, I’ll definitely let others know if I figure it out.

@pfaffman I used the command gem install rails to install it.

I used this guide to setup discourse - https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md

Can you link me to those guides or a guide that you recommend?

Needed to install some extra packages for the bundle install to run without errors in Ubuntu Mate 22.10 after following the Install Discourse for development using Docker guide:

sudo apt install ruby-bundler ruby-dev libpq-dev libmysqlclient-dev

However, there may be still something missing because when I try to run bundle exec rails db:drop it tells me Discourse requires Ruby 3.1 or above.
And ruby -v tells me I’m using ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-linux-gnu].

So I think there’s something wrong with the guides or the scripts.

7 posts were split to a new topic: Migrating a myBB forum to Discourse using Kubuntu in a VM