>  기사  >  데이터 베이스  >  mysql이 인코딩 수정에 실패하면 어떻게 해야 합니까?

mysql이 인코딩 수정에 실패하면 어떻게 해야 합니까?

藏色散人
藏色散人원래의
2020-11-02 09:16:391793검색

mysql 인코딩 실패에 대한 해결책은 연결 URL 뒤에 "?useUnicode=true&characterEncoding=UTF-8" 코드를 추가하는 것입니다.

mysql이 인코딩 수정에 실패하면 어떻게 해야 합니까?

추천: "mysql 비디오 튜토리얼"

인코딩 수정 실패에 대한 mysql 솔루션

문제 설명:

UTF8로 변경한 후 mysql을 다시 입력하면 자동으로 다시 다음으로 변경됩니다. latin1

아주 간단한 방법이 있습니다. URL에 연결한 후 다음 코드를 추가하면 됩니다.

?useUnicode=true&characterEncoding=UTF-8

두 속성 사이에 있는 앰퍼샌드 이스케이프 문자에 특히 주의해야 하며 공백이 없어야 합니다. 그렇지 않으면 오류가 보고됩니다.

hibernate.cfg.xml 구성 파일의 예는 다음과 같습니다.



 
     
< hibernate-configuration >
 
     < session-factory >
         < property name = "dialect" >
             org.hibernate.dialect.MySQLDialect
         
         < property name = "connection.url" >
             jdbc:mysql://localhost:3306/share?useUnicode=true&amp;characterEncoding=UTF-8
         
         < property name = "connection.username" >root
         < property name = "connection.password" >accp
         < property name = "connection.driver_class" >
             com.mysql.jdbc.Driver
         
         < property name = "myeclipse.connection.profile" >ssh
         < property name = "show_sql" >true
         < property name = "format_sql" >true
         < mapping resource = "cn/lihuoqing/po/ShUser.hbm.xml" />
         < mapping resource = "cn/lihuoqing/po/ShOptions.hbm.xml" />
         < mapping resource = "cn/lihuoqing/po/ShFiles.hbm.xml" />
         < mapping resource = "cn/lihuoqing/po/ShComments.hbm.xml" />
         < mapping resource = "cn/lihuoqing/po/ShDown.hbm.xml" />
     

============================== ====

1 데이터베이스 수준 수정

        a. 임시 변경:

                                                                                                 using using                                                 out ( 서버 수준만 변경하세요

2. 테이블 수준을 수정하세요

mysql>ALTER TABLE table_name DEFAULT CHARSET utf8;

변경 후 영구적으로 효과적이다

3. 열 수준 수정

      수정 예:

          mysql>alter 
table `products` change `products_model` `products_model` varchar( 20 ) 
         character set  utf8 collate utf8_general_ci null default null;

                                                         

            ~ ~ >                    use   my.ini 파일 사용                         use ' ' s 사용 ' ' s '를 사용하여 '  -를 사용합니다. /article/ 세부정보/51698845

위 내용은 mysql이 인코딩 수정에 실패하면 어떻게 해야 합니까?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.