>-----Original Message-----
>From: Carlos Williams [mailto:carlosw...@gmail.com]
>Sent: Monday, July 06, 2009 9:59 AM
>To: mysql@lists.mysql.com
>Subject: How To Clean Old Table Data
>
>I have an application that crates a users email info in MySQL every time
>they login into the application. The only problem is once I remove their
>account from the application/Linux, their user data remains in the MySQL
>table and will eventually clutter the database. I don't know how I
>should or
>can set something up that when I remove someone from the Linux system, I
>can
>also remove their data from MySQL.
>
[JS] It depends upon how you are removing their account. If you are doing it 
from a *NIX command line, then you can use a shell parameter. (You can use 
shell commands to prompt for the parameter.) Use the shell parameter to 
specify the account that you want to remove; then run the MySQL CLI with -e 
and use the shell parameter in the SQL command.

If you are removing the account using Plesk or some part of the application 
itself, then it is harder. I don't know if Plesk, CPanel, and such have hooks 
for external commands. If you can modify the application, put the database 
updates in there.

>mysql> select * from identities;
>+-------------+-----+----------+-----------------+--------------+-------
>----------------+----------+-----+------------+----------------+--------
>-+
>| identity_id | del | standard | name            | organization |
>email                 | reply-to | bcc | signature  | html_signature |
>user_id |
>+-------------+-----+----------+-----------------+--------------+-------
>----------------+----------+-----+------------+----------------+--------
>-+
>|           1 |   0 |        1 | Carlos Williams |              |
>j...@mdamusic.com <car...@ideorlando.org> |          |     | --
>Carlos |              0 |       1 |
>|           2 |   0 |        1 | carlos                  |
>|
>car...@mdamusic.com <car...@ideorlando.org> |          |     | NULL
>|              0 |       2 |
>|           3 |   0 |        1 | Carlos Williams |              |
>ja...@mdamusic.com <car...@iamunix.com> |          |     | Carlos
>|              0 |       3 |
>+-------------+-----+----------+-----------------+--------------+-------
>----------------+----------+-----+------------+----------------+--------
>-+
>3 rows in set (0.00 sec)
>
>
>Above I have connected to the database and I can see 3 users that are no
>longer present on the server however their user data is still stored in
>MySQL. How can I delete the entire row of data in the table.




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to