Database cleaning

This is not a Support area! Discuss about the Server here. Non-Server related discussion goes in Off-Topic Discussion.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
User avatar
gmakhs
Posts: 215
Joined: Sat Apr 14, 2007 12:00 pm

Database cleaning

Post 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
User avatar
qwerty13
Posts: 640
Joined: Mon Feb 02, 2009 9:57 am
Location: Europe
Contact:

Re: Database cleaning

Post 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.
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Database cleaning

Post 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!
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
User avatar
gmakhs
Posts: 215
Joined: Sat Apr 14, 2007 12:00 pm

Re: Database cleaning

Post by gmakhs »

thanks im gonna try it tommorow anbd ofc i will do backup first!
Post Reply