written to STDERR
时间: 2024-11-30 17:28:49 浏览: 10
The provided references do not directly address writing to STDERR (Standard Error). However, it can be inferred that in MySQL with the binarylog format set to ROW, only certain types of statements, like DDL (Data Definition Language) which you mentioned (e.g., CREATE TABLE, ALTER TABLE, or DROP TABLE), might result in non-row-based logging and therefore may write to STDERR if there's an error during execution.
When a DDL command fails due to constraints or permissions issues, the error message would typically be displayed on STDERR because the row-based format logs individual rows rather than entire statements. To explicitly handle errors and redirect them to STDERR, you'd need to use command-line options or programming constructs specific to your MySQL client or application.
For example, when running a potentially problematic DDL from the command line, you could use the `--quick` option to minimize the impact on the binary log, but any errors will still go to STDERR:
```bash
mysql -u username -p --quick --execute="CREATE TABLE IF NOT EXISTS ..."
```
To create a table while capturing errors to a file, you could use a script or tool like `expect` to redirect stderr to a log file:
```bash
mysql -u username -p < /path/to/your/script.sql 2> /path/to/error.log
```
In this case, if `general_log2` creation in `CREATE TABLE IF NOT EXISTS general_log2 LIKE general_log;` fails, the error will appear in the specified error.log file.
阅读全文