MySQL Query Scripts

Warning:

  • Always backup your database before you run any SQL script. There is no room for regret here.
  • Use the scripts provided here at your own risk.

About query scripts:

  • Commands issued to MySQL server are called queries
  • With few exceptions, queries (query commands) will end with a semi-colon, whether from command line or as script
  • Query scripts are text files containing queries
  • Non-numerical data must be placed between 2 single quotes
  • MySQL reserved words used as field or table name must be placed between backticks
  • Some ASCII characters used in queries (e.g apostrophe) must be "escaped" with a backslash if used in non-numerical data

Add login account:

This sample script will create new login account 1234567, user ID ROme, password passme, gender male, email me@localhost, GM level 0.
INSERT INTO `login` (account_id, userid, user_pass, sex, email, level) VALUES (1234567, 'ROme', 'passme', 'M', 'me@localhost', 0);

Change GM level:

This example script will change account 1234567 to GM40
UPDATE `login` SET level = 40 WHERE account_id = 1234567;

Delete login account:

This example script will remove account 1234567.
DELETE FROM `login` WHERE account_id = 1234567;




Q&A

I can edit data on my GUI client...

Some clients come with a built-in table editor which will let you do that. Whatever you have edited is saved immediately and without a warning. The danger is that you might accidentally edit some data. When that happens, you will be searching for a needle in the hay stack.

Why do MySQL data come in script?

Those scripts are called SQL dumps. Query script is the best way to handle a large among of data or repetitive entries. Backups of MySQL databases are always made in the form of query script which can be moved from place to place.

Can I use those scripts on Windows?

Yes, you can. In fact you can use them on any platform which MySQL server is installed. If you do not have a client with graphical user interface, you can run them on MySQL command line.

How do I convert Athena TXT flatfiles to MySQL?

You can compile the converter from Athena source codes and use it to convert flatfile databases of Athena TXT to format required by Athena SQL. Visit eAthena Forums and search Desbrina's posts for a link. I find compile and convert quite a bother and would rather use an editor to open the flatfile and use repetitive copy to turn it into sql script. Alternatively, you can use the import function of your MySQL client to get those data into the corresponding table. Sad to say, clients with that function are not free.