GROUP BY relatedThe "only_full_group_by" Sql_mode is turned on by default and only gets the fields affected by the group by when turned on, and the information for non-group by needs to be obtained through the Any_value (name) function (after MySQL 5.7)
ibatis Annotations Annotation method returns the value of the self-growing primary key ID just inserted
@Insert ("Insert into Product (title, image, Price, detail, summary, seller) VALUES (#{title},#{image},#{price},#{detail} , #{summary},#{seller}) @Options (usegeneratedkeys=true, keyproperty= "id")// Add the row, The ID in product is automatically added to the public Integer insertproduct (product product);
Garbled problem
The garbled characters caused by Tomcat are set in Server.xml:
<connector uriencoding= "UTF-8" connectiontimeout= "20000" port= "8080" protocol= "http/1.1" redirectport= "8443" Usebodyencodingforuri= "true"/>
Add the encoding format to the URL of the connection database, such as:
Jdbc.url= Jdbc:mysql://127.0.0.1:3306/electronic-business?useunicode=true&characterencoding=utf-8
Database settings:
mysql> SET character_set_client= ' GBK ';
mysql> SET character_set_connection= ' GBK '
mysql> SET character_set_results= ' GBK '
mysql> SET character_set_database= ' GBK ';
mysql> SET character_set_server= ' GBK '
mysql> SET character_set_results= ' GBK '
Change to GBK or Utf-8.
Common related commands: View database encoding format show variables like ' character_set_% '; View the creation of tables in the database Show create TABLE tablename; Set the database encoding format set names= ' GBK ' Or, under MySQL command line, enter \s to view the MySQL character set
BLOB format caused by garbled: Blob read out is ISO-8859-1 encoding, you need to convert to GBK encoding can be Java codestring blob =...blob = new String (Blob.getbytes ("iso-885901 ")," GBK ") or access large text with Mediumtext instead of blobs
CentOS 7 installs MySQL 5.7 with Yum 1. Download Yum Library shell > wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm2. Install Yum library Shell > Yum Localinstall-y MYSQL57-COMMUNITY-RELEASE-EL7-7.NOARCH.RPM3. Installing the database shell > Yum install-y Mysql-community-server4. Start the MySQL service shell > systemctl start Mysqld.service
FAQ--mysql