From: Carlos Eduardo Caldi Date: March 17 2010 12:17pm Subject: RE: Trancate table from command line? List-Archive: http://lists.mysql.com/mysql/220982 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="_90f3b203-c114-4cba-8a70-82137a7df581_" --_90f3b203-c114-4cba-8a70-82137a7df581_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable John I think you can do this way on shell: mysql -h db_server -u user -pPASSWORD -e "truncate table table1" Carlos Eduardo Caldi > Date: Tue=2C 16 Mar 2010 14:12:42 -0700 > From: joliver@stripped > To: mysql@stripped > Subject: Trancate table from command line? >=20 > Is there a way to use mysqladmin (or mysql) to truncate a table as a > one-off command from the command line? >=20 > I have an issue with importing data from one database into another=2C but > the second database might have columns that the first did not. >=20 > On database 1=2C I use mysqldump to grab certain tables=2C and when I try= to > simply "overlay" those tables onto the new database=2C I get an error=20 >=20 > ERROR 1062 (23000) at line 24: Duplicate entry '378-4' for key 1 >=20 > So we're thinking we should truncate the table first=2C but it appears > this must be done manually in the mysql> shell=2C which won't work... thi= s > operation needs to be scripted=2C or to be presented as one command line > that can be copy-and-pasted. >=20 > How can I do something like : >=20 > mysqladmin -h db_server -u user -pPASSWORD truncate table > table1 ? >=20 > --=20 > *********************************************************************** > * John Oliver http://www.john-oliver.net/ * > * * > *********************************************************************** >=20 > --=20 > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dce_caldi@hotmail.= com >=20 =20 _________________________________________________________________ N=E3o deixe rastros ao navegar na Internet. Instale Gr=E1tis o Internet Exp= lorer 8 agora. http://go.microsoft.com/?linkid=3D9707132= --_90f3b203-c114-4cba-8a70-82137a7df581_--