Related problems encountered by mysql

1, mysql Chinese display as? Solution

show variables like 'character_set_%';

show variables like 'collation_%';

character_set_database and character_set_server should be utf8, collation_database and collation_server should be utf8_general_ci.

If it is different, you need to modify /etc/my.cnf

First shut down the database and disconnect the database service

/etc/init.d/mysqld stop

service mysqld stop

After opening my.cnf, add the following two lines under [mysqld] in the file:

charcter_set_server=utf8

init_connect='SET NAMES utf8'

save and exit

Restart the database service

/etc/init.d/mysqld start

service mysqld start

2,

Modify database encoding format

alter database <database name> character set utf8;

Modify data table encoding format

alter table <表名> character set utf8;

Modify field encoding format

alter table <table name> change <field name> <field name> <type> character set utf8;

例如:alter table user change username username text character set utf8 not null;

3,

Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

View sql_mode

select @@sql_mode

Remove ONLY_FULL_GROUP_BY and reset the value.

set GLOBAL sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION ';

4,

Error Code:1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Queries and reconnect

set SQL_SAFE_UPDATES=0;

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324995847&siteId=291194637