From: Reindl Harald Date: December 2 2011 2:52am Subject: Re: delete syntax List-Archive: http://lists.mysql.com/mysql/226425 Message-Id: <4ED83D6A.5010706@thelounge.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9F3B49B5147070549471890B" --------------enig9F3B49B5147070549471890B Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable ALWAYS start with "select * from mysql.user where user=3D'mail_admin' and host l= ike '\%';" and look what records are affected to make sure the were-statement works = as expected and then use "CURSOR UP" and edit the last command to "delete fr= om" not only doing this while unsure with escapes protects you against logic= al mistakes like forget a "and column=3D1" and get "1000 rows affected" with= no way back Am 02.12.2011 03:43, schrieb Shiva: > delete from mysql.user where user=3D'mail_admin' and host like '\%' ; > Note: I haven't tested it and since % is a wildcard you need to escape = it. >=20 > On Thu, Dec 1, 2011 at 6:09 PM, Tim Dunphy wr= ote: >=20 >> >> Thanks but I probably should have noted that I only want to delete the= >> wildcard user. There are other users I would prefer to not delete. >> >> mysql> select user,host from mysql.user where user=3D'mail_admin'; >> +------------+-----------------------+ >> | user | host | >> +------------+-----------------------+ >> | mail_admin | % | >> | mail_admin | 127.0.0.1 | >> | mail_admin | localhost | >> | mail_admin | localhost.localdomain | >> +------------+-----------------------+ >> 4 rows in set (0.00 sec) --------------enig9F3B49B5147070549471890B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7YPWsACgkQhmBjz394AnlpegCgmlYWfUc6Zbvs+R5fYwxXhrIT RQQAnjOEInAKeTmifVT8MgMHlMSXpQmy =bSWV -----END PGP SIGNATURE----- --------------enig9F3B49B5147070549471890B--