0

For example, after an INSERT, I see:

Query OK, 296 rows affected (0.02 sec)
Records: 296 Duplicates: 0 Warnings: 0

I would like to see timestamps with these lines, if possible, e.g.:

2019-02-15 12:00:00.000 - Query OK, 296 rows affected (0.02 sec)
2019-02-15 12:00:00.020 - Records: 296 Duplicates: 0 Warnings: 0

Can I configure MySQL to do this?

  • No, but your own client code in a particular scripting language could. There are also script helping programs that can prepend timestamps to arbitary output. Can you describe the context more for a more general answer. – danblack Feb 16 at 1:32
1

https://dev.mysql.com/doc/refman/5.7/en/mysql-commands.html

This is close to what you wanted:

mysql> prompt \D  \R:\m:\s >
PROMPT set to '\D  \R:\m:\s >'
Sat Feb 16 02:10:47 2019  02:10:47 >SELECT NOW(6);
+----------------------------+
| NOW(6)                     |
+----------------------------+
| 2019-02-16 02:10:59.885525 |
+----------------------------+
1 row in set (0.00 sec)
Sat Feb 16 02:10:59 2019  02:10:59 >

But, alas, it does not do all of what you want:

Fri Feb 15 18:13:49 2019  18:13:49 >INSERT INTO abc VALUES ('asdf');
Query OK, 1 row affected (0.01 sec)

Fri Feb 15 18:14:04 2019  18:14:04 >

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.