How to update all MySQL table rows at the same time?

Viewed 146944

How do I update all MySQL table rows at the same time?

For example, I have the table:

id    |  ip    | port      |  online_status |
1     |  ip1   | port1     |                |
2     |  ip2   | port2     |                |
3     |  ip3   | port3     |                |
4     |  ip4   | port4     |                |
5     |  ip5   | port5     |                |

I'm planning to create cronjob and monitor some servers, but I don't know exactly how to update them all from the table at the same time. What are some examples on how to do that?

7 Answers

Just add parameters, split by comma:

UPDATE tablename SET column1 = "value1", column2 = "value2" ....

see the link also MySQL UPDATE

Related