Page 1 of 1

Database cleaning

Posted: Sat Nov 27, 2010 2:13 pm
by gmakhs
hi im looking foward to clean up my database im writing this post to ask for help ut i will keep googling.

i m looking for a script that will delte all empty accounts

Re: Database cleaning

Posted: Sat Nov 27, 2010 3:30 pm
by qwerty13
all this is done on each server startup.. just run

DELETE FROM characters WHERE account_name LIKE "put the sad account here";
DELETE FROM accounts WHERE login LIKE "put the sad account here";
Btw, first try it on test server.

Re: Database cleaning

Posted: Sat Nov 27, 2010 3:56 pm
by janiii
it depends
- if you have login tables in same database as gameserver tables:

Code: Select all

DELETE FROM accounts WHERE login NOT IN (SELECT DISTINCT(account_name) FROM characters);
- if they are in separate databases but same machine )l2j_login is the login database name, l2j_game is the gameserver database name):

Code: Select all

DELETE FROM l2j_login.accounts WHERE login NOT IN (SELECT DISTINCT(account_name) FROM l2j_game.characters);
be sure to make a backup before!

Re: Database cleaning

Posted: Sat Nov 27, 2010 8:24 pm
by gmakhs
thanks im gonna try it tommorow anbd ofc i will do backup first!