PDA

View Full Version : Mysql/DB question


Spedfist
06-23-2003, 01:31 PM
how would i go about clearing a table so i can source information from a sql formatted text file just for that table, for example: i want to source info from city_defense.txt, but i need to clear the info thats already in the table first so i dont get duplicate errors

burthold
06-23-2003, 01:35 PM
truncate table <table name>

Memener
06-23-2003, 01:36 PM
if you get duplicate errors it means it is already sourced into your database if you get a mismatch error then you have problems

Spedfist
06-23-2003, 01:36 PM
woot thanks a bunch!

Spedfist
06-23-2003, 01:42 PM
i was resourcing with a newer version of the table is what i was doing, so wanted to know just how to drop individual table, but......another question...how do i clear the whole database

Memener
06-23-2003, 01:44 PM
to delete the whole Database open mysql and type drop database eq; then hit enter but if you want to back up the chars or item i dont know those commands

Velosity
06-23-2003, 06:25 PM
if you wish to drop a table just go into mysql and type this


MySql> use databasename;
Database Changed
MySql> drop table tablename;
Query OK, Yadda Yadda


If you wish to back up your database open up your command prompt (open start menue, go to run, open cmd) or open your MS-DOS prompt

then type this in


C:\>cd c:\mysql\bin
C:\Mysql\Bin\> mysqldump databasename > filename.sql


That will put your database in a sql file

If you want just a specific table from your database dumped so you can do a drop table command type this


C:\>cd c:\mysql\bin
C:\Mysql\Bin\> mysqldump databasename tablename > filename.sql


Hope that helps

Spedfist
06-24-2003, 12:46 PM
how would i go about only backing up the character saves that are in the db? and then how to restore those?

thanks for all of the help btw =)

Lurker_005
06-24-2003, 01:20 PM
truncate table <table name>

Ahh I was looking for the command that behaved that way last week :p

Specifically a way to get the autoassigned ID's to start at the beginning again (doors table). I ended dropping the table and recreating it manually :p Much easier! Thanks

burthold
06-24-2003, 01:38 PM
the truncate will restart the incramenting key.

Wes