M6mal

server wipe

5 posts in this topic

if one does a server wipe , do you lose all of your players money , vehicles and territories etc.

Share this post


Link to post
Share on other sites

Yes, if you know how to merge then no. 

Share this post


Link to post
Share on other sites
Advertisement

Another question on this issue, if i was to wipe the server and load all the files and mods in and have a fresh start, am I then able to reload a database back up onto the server so the players have there accounts back?

 

Thanks razor

Share this post


Link to post
Share on other sites

Posted (edited)

To create the backup database, the accounts table, and import data from multiple source databases (exile1, exile2, and exile3) change to whatever your db's are named.

Spoiler

create database exile_backup;
use exile_backup;

--
-- Table structure for table `account`
--
CREATE TABLE `account` (
  `uid` varchar(32) NOT NULL,
  `clan_id` int(11) UNSIGNED DEFAULT NULL,
  `name` varchar(64)  NOT NULL,
  `money` double NOT NULL DEFAULT '0',
  `score` int(11) NOT NULL DEFAULT '0',
  `kills` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `deaths` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `first_connect_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_connect_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_disconnect_at` datetime DEFAULT NULL,
  `total_connections` int(11) UNSIGNED NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Indexes for table `account`
--
ALTER TABLE `account`
  ADD PRIMARY KEY (`uid`),
  ADD KEY `clan_id` (`clan_id`);  
-- Merge latest record  
insert into exile_backup.account
select  uid, null clan_id, max(name), sum(money), sum(score), sum(kills), sum(deaths), min(first_connect_at), max(last_connect_at), max(last_disconnect_at), sum(total_connections)
from
(select * from exile.account union all
select * from exile2.account union all
select * from exile3.account) a
group by uid;

commit;

if you have only one database, this:

Spoiler

(select * from exile.account union all
select * from exile2.account union all
select * from exile3.account) a

changes to

Spoiler

(select * from exile.account) a

 

 

Don't forget to turnicate to empty the databases before importing from the backup to the live, or else errors. (TURNICATE WILL DELETE ALL DATA IN THE SELECTED TABLE OR DATABASE, USE WITH CAUTION)

 

To put it all back,

Spoiler

use exile;

insert into exile.account
select  uid, null clan_id, max(name), sum(money), sum(score), sum(kills), sum(deaths), min(first_connect_at), max(last_connect_at), max(last_disconnect_at), sum(total_connections)
from
(select * from exile_backup.account) a
group by uid;

commit;

 

Edited by wasti
1 person likes this

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.