mysql-5.7

mysql, space equals empty string

对着背影说爱祢 提交于 2019-12-01 01:15:54
问题 Just took me 2 hours to troubleshoot an issue on my backend. Cause was that of empty string being equal to space: SELECT ' ' = ''; -> 1 SELECT STRCMP(' ', ''); -> 0 /* means equal */ Interestingly enough, SELECT '' REGEXP '[ ]'; -> 0 SELECT '' REGEXP ' '; -> 0 SELECT ' ' REGEXP ' '; -> 1 Can I prevent this? Is it a setting? 回答1: The reason this fails is explained in the docs here http://dev.mysql.com/doc/refman/5.0/en/char.html: Values in CHAR and VARCHAR columns are sorted and compared

Store/Retrieve Json data to/from Mysql 5.7 database using hibernate

柔情痞子 提交于 2019-11-30 13:57:35
问题 I am going to start a project where I need to generate dynamic google forms. The requirement for this project is I need to use mysql 5.7 so that I could use json datatype to store/retrieve json data. I am fine with this. I know, it is possible using HQL. But what I couldn't figure out is how do I implement it with Hibernate using object relational mapping ? Any Ideas ? Thanks in advance ! 回答1: Recently I have solved similar task. I guess it's too late, but maybe someone finds this useful.

What is the default root pasword for MySQL 5.7

落花浮王杯 提交于 2019-11-29 18:59:36
Cannot login to MySQL database after fresh install with root ID and empty/no password like other older MySQL versions do After you installed MySQL-community-server 5.7 from fresh on linux, you will need to find the temporary password from /var/log/mysqld.log to login as root. grep 'temporary password' /var/log/mysqld.log Run mysql_secure_installation to change new password ref: http://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html There's so many answers out there saying to reinstall mysql or use some combo of mysqld_safe --skip-grant-tables and / or UPDATE mysql.user SET

VARCHAR vs TEXT performance when data fits on row

丶灬走出姿态 提交于 2019-11-29 13:45:59
问题 mysql> desc temp1; +-------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+--------------+------+-----+---------+-------+ | value | varchar(255) | YES | | NULL | | +-------+--------------+------+-----+---------+-------+ mysql> desc temp2; +-------+------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+------+------+-----+---------+-------+ | value | text | YES | | NULL | | +-------+------+------+

Stored procedure raising “incompatible with sql_mode=only_full_group_by” despite sql_mode being blank

狂风中的少年 提交于 2019-11-29 08:13:59
I have a stored procedure that ran fine on MySQL 5.6. During a recent server migration we upgraded to MySQL 5.7.19. My stored procedure now throws the error: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'utility-monitor.daily_readings.building_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by: CALL monthly_readings(2017, 1, NULL, 1, 1)) I've set the sql_mode to "" via the /var/mysql/my.cnf file, restarted the mysql service and logged in via console to confirm that sql_mode is

How can solve JSON column in H2

浪子不回头ぞ 提交于 2019-11-29 05:35:22
问题 I use in application MySQL 5.7 and I have JSON columns. When I try running my integration tests don't work because the H2 database can't create the table. This is the error: 2016-09-21 16:35:29.729 ERROR 10981 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table payment_transaction (id bigint generated by default as identity, creation_date timestamp not null, payload json, period integer, public_id varchar(255) not null, state varchar(255) not null,

Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

大憨熊 提交于 2019-11-28 19:38:19
问题 I installed MySQL community server 5.7.10 using binary zip. I extracted the zip in c:\mysql and created the data folder in c:\mysql\data . I created the config file as my.ini and placed it in c:\mysql (root folder of extracted zip). Below is the content of the my.ini file # set basedir to your installation path basedir=C:\mysql # set datadir to the location of your data directory datadir=C:\mysql\data I'm trying to start MySQL using mysqld --console , but the process is aborted with the below

What is the default root pasword for MySQL 5.7

ⅰ亾dé卋堺 提交于 2019-11-28 13:57:40
问题 Cannot login to MySQL database after fresh install with root ID and empty/no password like other older MySQL versions do 回答1: There's so many answers out there saying to reinstall mysql or use some combo of mysqld_safe --skip-grant-tables and / or UPDATE mysql.user SET Password=PASSWORD('password') and / or something else ... ... None of it was working for me Here's what worked for me, on Ubuntu 18.04, from the top With special credit to this answer for digging me out of the frustration on

How to solve mysql warning: “InnoDB: page_cleaner: 1000ms intended loop took XXX ms. The settings might not be optimal ”?

依然范特西╮ 提交于 2019-11-27 18:08:18
I ran a mysql import mysql dummyctrad < dumpfile.sql on server and its taking too long to complete. The dump file is about 5G. The server is a Centos 6, memory=16G and 8core processors, mysql v 5.7 x64- Are these normal messages/status "waiting for table flush" and the message InnoDB: page_cleaner: 1000ms intended loop took 4013ms. The settings might not be optimal mysql log contents 2016-12-13T10:51:39.909382Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 4013ms. The settings might not be optimal. (flushed=1438 and evicted=0, during the time.) 2016-12-13T10:53:01.170388Z 0 [Note]

How to update JSON data type column in MySQL 5.7.10?

只愿长相守 提交于 2019-11-27 10:47:45
问题 I have started using MySQL 5.7.10 recently and I am liking the native JSON Data type a lot. But I ran into a problem when it comes to updating a JSON type value. Questions: Below is the table format, here I want to add 1 more key in JSON data column for t1 table. Right now I have to fetch the value modify it and Update the table. So it involves an extra SELECT statement. I can insert like this INSERT INTO t1 values ('{"key2":"value2"}', 1); mysql> select * from t1; +--------------------+-----