Restitutor is the pride of <SUBJECT HOMETOWN HERE>

MC2 MySQL Stats Port Process

No replies
RestitutorOrbis's picture
Name: RestitutorOrbis (Restitutor)
Offline
Princeps
Joined: Aug 24 2014
Posts:

When MC2 Factions was moved to 16net, the MySQL data needed to be moved as well to the new machine.

First, mysqldump was used to create a sql file to export all tables prefixed with MC2Stats.

Then, all the MC2 Stats data needed to be removed from 16net. To do this, a list of all such tables were needed.
The sql dump file was opened with Notepad++ and all files beginning with "DROP TABLE IF EXISTS" were found resulting in one line per table. Then alt drag was used to get just the raw statements.


e.g.
DROP TABLE IF EXISTS `MC2Stats_arrows`;
DROP TABLE IF EXISTS `MC2Stats_beds_entered`;
DROP TABLE IF EXISTS `MC2Stats_blocks_broken`;
DROP TABLE IF EXISTS `MC2Stats_blocks_placed`;
DROP TABLE IF EXISTS `MC2Stats_buckets_emptied`;
DROP TABLE IF EXISTS `MC2Stats_buckets_filled`;
DROP TABLE IF EXISTS `MC2Stats_commands_done`;
DROP TABLE IF EXISTS `MC2Stats_damage_taken`;
DROP TABLE IF EXISTS `MC2Stats_death`;
DROP TABLE IF EXISTS `MC2Stats_eggs_thrown`;
DROP TABLE IF EXISTS `MC2Stats_fish_caught`;
DROP TABLE IF EXISTS `MC2Stats_items_crafted`;
DROP TABLE IF EXISTS `MC2Stats_items_dropped`;
DROP TABLE IF EXISTS `MC2Stats_items_picked_up`;
DROP TABLE IF EXISTS `MC2Stats_joins`;
DROP TABLE IF EXISTS `MC2Stats_kill`;
DROP TABLE IF EXISTS `MC2Stats_last_join`;
DROP TABLE IF EXISTS `MC2Stats_last_seen`;
DROP TABLE IF EXISTS `MC2Stats_locks`;
DROP TABLE IF EXISTS `MC2Stats_money`;
DROP TABLE IF EXISTS `MC2Stats_move`;
DROP TABLE IF EXISTS `MC2Stats_omnomnom`;
DROP TABLE IF EXISTS `MC2Stats_players`;
DROP TABLE IF EXISTS `MC2Stats_playtime`;
DROP TABLE IF EXISTS `MC2Stats_pvp`;
DROP TABLE IF EXISTS `MC2Stats_pvp_streak`;
DROP TABLE IF EXISTS `MC2Stats_pvp_top_streak`;
DROP TABLE IF EXISTS `MC2Stats_shears`;
DROP TABLE IF EXISTS `MC2Stats_teleports`;
DROP TABLE IF EXISTS `MC2Stats_times_changed_world`;
DROP TABLE IF EXISTS `MC2Stats_times_kicked`;
DROP TABLE IF EXISTS `MC2Stats_tools_broken`;
DROP TABLE IF EXISTS `MC2Stats_trades`;
DROP TABLE IF EXISTS `MC2Stats_words_said`;
DROP TABLE IF EXISTS `MC2Stats_xp_gained`;

These statements were executed on 16net to remove the tables. Now the 16net MySQL database is simpler and the only copy is in the exported sql file.

Now on the new machine, a user and database were created from factions. Using a format similar to that below.
create database factions;
create user 'factions'@'localhost' identified by '????????????';
grant all on factions.* to 'factions'@'localhost';

Then the sql file was opened with Notepad++ and all instances of the substring MC2 removed. Then it was imported.
mysql -u factions -p factions < mcserver.sql

n/a