The code is as follows:
Errors are reported as follows:
First, why does this error occur:
The analysis is as follows:
With the popularity of smartphones, we begun to often use emoticons to help us communicate better. However, the utf8 encoding of MySQL only supports 3 bytes of data, while the expression data of the mobile terminal is 4 bytes of characters, so utf8mb4 appears (its minimum MySQL version supports version 5.5.3 +, while mine is 5.1, so an error is caused)
Problem-solving:
Uninstall MySQL version 5.1 and install the new version
Here is an installation blog: CentOS installation mysql8.0
After installation, run the program again,
The program runs normally