List:General Discussion« Previous MessageNext Message »
From:Reindl Harald Date:December 2 2011 2:52am
Subject:Re: delete syntax
View as plain text  
ALWAYS
start with "select * from mysql.user where user='mail_admin' and host like '\%';"
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 from"

not only doing this while unsure with escapes  protects you against logical
mistakes like forget a "and column=1" and get "1000 rows affected" with no
way back

Am 02.12.2011 03:43, schrieb Shiva:
> delete from mysql.user where user='mail_admin' and host like '\%' ;
> Note: I haven't tested it and since % is a wildcard you need to escape it.
> 
> On Thu, Dec 1, 2011 at 6:09 PM, Tim Dunphy <bluethundr@stripped> wrote:
> 
>>
>> 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='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)


Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Thread
delete syntaxTim Dunphy2 Dec
  • Re: delete syntaxKrishna Chandra Prajapati2 Dec
    • Re: delete syntaxTim Dunphy2 Dec
      • Re: delete syntaxShiva2 Dec
        • Re: delete syntaxReindl Harald2 Dec
          • Re: delete syntaxStdranwl2 Dec
            • Re: delete syntaxReindl Harald2 Dec
              • Re: delete syntaxClaudio Nanni2 Dec
                • Re: delete syntaxReindl Harald2 Dec
                  • Re: delete syntaxGovinda2 Dec
                    • How to get a specific number of entries per one key ?Blog Tieng Viet3 Dec
                      • Re: How to get a specific number of entries per one key ?Arthur Fuller3 Dec
                        • Re: How to get a specific number of entries per one key ?Rik Wasmus5 Dec
    • Re: delete syntaxKeith Keller2 Dec