Syntax errors caused by mysql reserved keywords

When executing the original program in a new mysql environment, a syntax error is prompted. After checking, it is found that the mysql version of the environment is mysql8. The word groups has become a reserved keyword since mysql8.0.2. It is temporarily replaced by `groups`. It should still be used in the future. Be careful to avoid this kind of pitfalls.

You have an error in your SQL syntax...

Official documentation: https://dev.mysql.com/doc/refman/8.0/en/keywords.html

Mysql column conversion group_concat function

The group_concat function in MySQL can combine the specified fields of the group into one row of content, which is more suitable for column conversion.

The complete syntax is as follows:

group_concat([DISTINCT] Field to be concatenated [Order BY ASC/DESC sorting field] [Separator 'separator'])

The default delimiter is comma

Example:

select id,group_concat(distinct name) from table group by id;  

It should be noted that there is a default limit on the length of the merged fields.


refer to:

Mysql connection database localhost is slower than 127.0.0.1

During the development process of php+mysql, when filling in the host name for connecting to the database, the local machine can generally use localhost or 127.0.0.1. In the actual application process, no abnormalities have been found in the Linux system, but in the Windows server system, there are When writing localhost, the web page response will be relatively slow. Generally, it takes more than 1 second to complete a page. I judged the program running time step by step and found that it was a problem when connecting to mysql. It takes nearly 1 second to establish a connection.

Solve the problem of secure-file-priv option when importing and exporting mysql data

Mysql database imports or exports from a file to a file, prompting The MySQL server is running with the --secure-file-priv option so it cannot execute this statement. The reasons and solutions are as follows:

Some versions of mysql have restrictions on import and export through files, which are not allowed by default.

View the configuration and execute the mysql command

Subscribe to mysql