Trying to migrate data to new server

Summary
After migrating data and config from Bitnami Mattermost VM to a new Ubuntu 18.04 VM there are no users, no channels

Steps to reproduce
mysql:
drop database mattermost;
create database mattermost;
grant all privileges on mattermost.* to ‘mmuser’@’%’
exit

mysql -u root mattermost < /tmp/data.sql

cd /opt/mattermost/data
tar xfz /tmp/d.tgz

copy config.json from old to new server, modify Site URL, modify SQL data source to point at new (mattermost) DB with new DB user/passwd

service mattermost start

Expected behavior
Expecting all user accounts from the old server to work, expecting old server’s admin account to work, expecting all content/channels to be present

Observed behavior
When I access the new site URL, I am prompted to create a new account. Can’t log into any existing accounts from old server, including the admin account. Error: Enter a valid email or username and/or password.

If I create a new account, it is the only account shown on the server, and there are no existing channels.

mattermost.log:
{“level”:“info”,“ts”:1630514897.8282275,“caller”:“app/server.go:226”,“msg”:“Server is initializing…”,“go_version”:“go1.15.5”}
{“level”:“info”,“ts”:1630514897.8282833,“caller”:“app/web_hub.go:83”,“msg”:“Starting websocket hubs”,“number_of_hubs”:4}
{“level”:“info”,“ts”:1630514897.8288515,“caller”:“utils/i18n.go:91”,“msg”:“Loaded system translations”,“for locale”:“en”,“from locale”:"/opt/mattermost/i18n/en.json"}
{“level”:“info”,“ts”:1630514897.8975456,“caller”:“sqlstore/store.go:255”,“msg”:“Pinging SQL”,“database”:“master”}
{“level”:“info”,“ts”:1630514900.8949013,“caller”:“sqlstore/upgrade.go:125”,“msg”:“The database schema version has been set”,“version”:“5.32.1”}
{“level”:“info”,“ts”:1630514909.7061725,“caller”:“app/license.go:67”,“msg”:“License key from https://mattermost.com required to unlock enterprise features.”}
{“level”:“info”,“ts”:1630514909.7452178,“caller”:“app/server.go:511”,“msg”:“Current version is 5.32.1 (5.32.1/Wed Feb 17 15:05:15 UTC 2021/230fa42c7e9055c011f3996663166fccbfbda02f/4ab25ee394b2324ab99a355bfe8c89f24cfb64d4)”,“current_version”:“5.32.1”,“build_number”:“5.32.1”,“build_date”:“Wed Feb 17 15:05:15 UTC 2021”,“build_hash”:“230fa42c7e9055c011f3996663166fccbfbda02f”,“build_hash_enterprise”:“4ab25ee394b2324ab99a355bfe8c89f24cfb64d4”}
{“level”:“info”,“ts”:1630514909.7452898,“caller”:“app/server.go:520”,“msg”:“Enterprise Build”,“enterprise_build”:true}
{“level”:“info”,“ts”:1630514909.7453344,“caller”:“app/server.go:526”,“msg”:“Printing current working”,“directory”:"/opt/mattermost"}
{“level”:“info”,“ts”:1630514909.745368,“caller”:“app/server.go:527”,“msg”:“Loaded config”,“source”:“file:///opt/mattermost/config/config.json”}
{“level”:“info”,“ts”:1630514909.7623248,“caller”:“bleveengine/bleve.go:295”,“msg”:“UpdateConf Bleve”}
{“level”:“info”,“ts”:1630514909.8292499,“caller”:“app/server.go:950”,“msg”:“Starting Server…”}
{“level”:“info”,“ts”:1630514909.8293874,“caller”:“app/server.go:1027”,“msg”:“Server is listening on 127.0.0.1:8065”,“address”:“127.0.0.1:8065”}
{“level”:“info”,“ts”:1630514909.8294067,“caller”:“commands/server.go:117”,“msg”:“Sending systemd READY notification.”}
{“level”:“info”,“ts”:1630514929.6201067,“caller”:“app/migrations.go:26”,“msg”:“Migrating roles to database.”}
{“level”:“info”,“ts”:1630514929.792502,“caller”:“app/migrations.go:102”,“msg”:“Migrating emojis config to database.”}
{“level”:“info”,“ts”:1630514932.486291,“caller”:“mlog/log.go:218”,“msg”:“Starting up plugins”}
{“level”:“info”,“ts”:1630514932.486381,“caller”:“app/plugin.go:226”,“msg”:“Syncing plugins from the file store”}
{“level”:“info”,“ts”:1630514934.068744,“caller”:“jobs/workers.go:98”,“msg”:“Starting workers”}
{“level”:“info”,“ts”:1630514934.0692534,“caller”:“app/license.go:67”,“msg”:“License key from https://mattermost.com required to unlock enterprise features.”}
{“level”:“info”,“ts”:1630514934.070966,“caller”:“jobs/schedulers.go:89”,“msg”:“Starting schedulers.”}

Database is MySQL 5.8 on the old server, 5.7.35 on the new. Since I’m moving from Bitnami to Ubuntu, it’s hard to get an exact match. Not sure if that is the issue. Also, I’m setting the new server up in parallel with the existing one, so I can test it prior to going live. As such the Site URL is different (in config.json). Not sure if that causes any issues. The MM version on both is identical (5.32.1)

I’m running out of ideas, I’ve tried nine ways to Sunday to get this migration to work. Same result each time. Appreciate any help you can provide.

Can you access the database from the MySQL command-line interface, and view any of the data in the tables?

1 Like

I can indeed access the data from the CLI, though you might be on to something. I see two sets of tables: one with a capitalized table name and one with a lowercase. For example, Users and users. On my original Bitnami instance, the tables are all lowercase.

mysql> show tables;
±-----------------------+
| Tables_in_mattermost |
±-----------------------+
| Audits |
| Bots |
| ChannelMemberHistory |
| ChannelMembers |
| Channels |
| ClusterDiscovery |
| CommandWebhooks |
| Commands |
| Compliances |
| Emoji |
| FileInfo |
| GroupChannels |
| GroupMembers |
| GroupTeams |
| IncomingWebhooks |
| Jobs |
| Licenses |
| LinkMetadata |
| OAuthAccessData |
| OAuthApps |
| OAuthAuthData |
| OutgoingWebhooks |
| PluginKeyValueStore |
| Posts |
| Preferences |
| ProductNoticeViewState |
| PublicChannels |
| Reactions |
| Roles |
| Schemes |
| Sessions |
| SidebarCategories |
| SidebarChannels |
| Status |
| Systems |
| TeamMembers |
| Teams |
| TermsOfService |
| ThreadMemberships |
| Threads |
| Tokens |
| UploadSessions |
| UserAccessTokens |
| UserGroups |
| UserTermsOfService |
| Users |
| audits |
| bots |
| channelmemberhistory |
| channelmembers |
| channels |
| clusterdiscovery |
| commands |
| commandwebhooks |
| compliances |
| emoji |
| fileinfo |
| groupchannels |
| groupmembers |
| groupteams |
| incomingwebhooks |
| jobs |
| licenses |
| linkmetadata |
| oauthaccessdata |
| oauthapps |
| oauthauthdata |
| outgoingwebhooks |
| pluginkeyvaluestore |
| posts |
| preferences |
| productnoticeviewstate |
| publicchannels |
| reactions |
| roles |
| schemes |
| sessions |
| sidebarcategories |
| sidebarchannels |
| status |
| systems |
| teammembers |
| teams |
| termsofservice |
| threadmemberships |
| threads |
| tokens |
| uploadsessions |
| useraccesstokens |
| usergroups |
| users |
| usertermsofservice |
±-----------------------+
92 rows in set (0.00 sec)

OK, thank you for pointing me in the right direction, LBP.

mysqladmin -u root -p variables | grep lower_case_table_names

reveals that variable is set to a ‘1’ on my old Bitnami instance, but a ‘0’ on the new Ubuntu instance. On the new machine, I dropped the database, then set

lower_case_table_names = 1

in mysqld.cnf. Restarted mysql, restored the DB from backup again, and now Mattermost seems to be working. And as expected, all tables are named in lower case with no duplicates.

Not sure if forcing lower case table names will cause any issues in the future, but I’ll burn that bridge when I get there.

1 Like

That’s the right solution! Thank you very much.