FAQ--mysql

Source: Internet
Author: User
Tags mysql command line

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.