View Single Post
  #3  
Old 12-13-2003, 05:10 AM
vbemos
Fire Beetle
 
Join Date: Oct 2003
Location: Worcester, UK
Posts: 16
Default

I think the best way to view the database is in mySQL, these are the basics, make sure you back your database up before you start, I don't want to be responsible for a destroyed db (to do this goto the \data folder in mysql and copy out the eq folder, you can paste it back if all goes wrong) **lol**

once your on it type
Quote:
USE eq;
to select that db, or whatever you called it then
Quote:
SHOW TABLES;
and it will list all the tables in the db,
Quote:
DESCRIBE <tablename>;
will tell you what the table is made up of for example:
Quote:
mysql> DESCRIBE inventory;
+---------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-----------------------+------+-----+---------+-------+
| charid | int(10) unsigned | YES | | 0 | |
| slotid | smallint(6) unsigned | YES | MUL | 0 | |
| itemid | mediumint(7) unsigned | YES | | 0 | |
| charges | tinyint(3) unsigned | YES | | 0 | |
| color | int(11) unsigned | | | 0 | |
+---------+-----------------------+------+-----+---------+-------+
5 rows in set (0.10 sec)
To view records in the db type
Quote:
SELECT <fields> FROM <table> WHERE <clause>;
Example: SELECT id, name, password, status FROM account WHERE status > 200;
Example: SELECT id, name, password, status FROM account WHERE name LIKE '%eq%'
Note that % is the wildcard in mySQL, to add a record type
Quote:
INSERT INTO <table> VALUES (<values>)
Example: INSERT INTO forage VALUES (0, 100, 1001, 1);
To change an Existing record do:
Quote:
UPDATE <table> SET <field>=<newvalue> WHERE <clause>;
Example: UPDATE accounts SET password='newpassword', status=200 WHERE name like '%eqemu%';
To delete a record type
Quote:
DELETE FROM <table> WHERE <clause>;
Example: DELETE FROM zone_points WHERE id=101;
to Delete a database or table type:
Quote:
DROP TABLE <tablename>; or DROP DATABASE <dbname>;
Example: DROP DATABASE eq; <Don't try it :P
to create a table do:
Quote:
CREATE TABLE <tablename>(<fieldname> <type>)
Example: CREATE TABLE people (name varchar(20), age int(3), dob date);
to create a db type
Quote:
CREATE DATABASE <dbname>;
Example: CREATE DATABASE eq2;
to make a source file you need to run another program call mysqldump (in the same dir as mysql) type at a command prompt:
Quote:
mysqldump <db> <table>
Example: mysqldump eq, account;
and to source it in as you know its
Quote:
source <path>;
How that was what you wanted??
Reply With Quote