mysql-5.7

Is there a way to populate a MySQL 5.7 table with data from a json file with line breaks on Win7?

ⅰ亾dé卋堺 提交于 2019-12-07 18:10:00
问题 I have following example json file and I'm trying to populate a MySQL table with it. Since MySQL 5.7 supports json as a native datatype I thought this shouldn't be a problem, but MySQL's json validator seems to have a problem with the line breaks inside the file. As soon as I get rid of all line breaks and write my example file in one line, it works perfectly. [ { "somestuff": [ { "field1": "val1", "field2": 17, "field3": 27, "field4": 42, "field5": 73 }, { "field1": "val2", "field2": 3,

MySQL NOT IN Query much slower after Mysql Upgrade

二次信任 提交于 2019-12-07 16:52:13
问题 It's a very simple query: SELECT * FROM temp_company WHERE number NOT IN (SELECT number FROM company) It was taking 15 minutes before but that was on a Mysql installation with too low buffer pool size and 15 minutes was OK because this is a monthly task. I upgraded to Mysql 5.7 (from something like 5.1 or 5.2) as the original install was 32bit and I couldn't up the innodb buffer pool size to the minimum required 10gb for this DB (I've set it to 16GB on a machine with 32GB RAM. I've now gone

MySQL nested JSON column search and extract sub JSON

回眸只為那壹抹淺笑 提交于 2019-12-06 22:29:15
问题 I have a MySQL table authors with columns id , name and published_books . In this, published_books is a JSON column. With sample data, id | name | published_books ----------------------------------------------------------------------- 1 | Tina | { | | "17e9bf8f": { | | "name": "Book 1", | | "tags": [ | | "self Help", | | "Social" | | ], | | "language": "English", | | "release_date": "2017-05-01" | | }, | | "8e8b2470": { | | "name": "Book 2", | | "tags": [ | | "Inspirational" | | ], | |

Invalid JSON text in argument 2 - json_contains in MySQL 5.7.8

和自甴很熟 提交于 2019-12-06 17:30:35
问题 I have a database with one column that is JSON of strings (ex. ["ART","LIT"], etc.). I want to search it using json_contains . However, when I try: json_contains(\`column_name`,"ART") It errors saying: Invalid JSON text in argument 2 to function json_contains: "Invalid value." at position 0 in 'ART'. Note that json_contains doesn't error with numbers in the place of "ART", just with strings. Any idea what I can do to fix/get around this? 回答1: Apparently, it treats integers differently from

Will this be stored on page?

让人想犯罪 __ 提交于 2019-12-06 13:27:54
问题 http://dev.mysql.com/doc/refman/5.7/en/innodb-row-format-dynamic.html Can someone explain depends on the page size and the total size of the row ? If I use InnoDB and keep the default settings, then create a table with 60 bytes + a MEDIUMTEXT with 10kb data , will the MEDIUMTEXT be stored on page or off page? 回答1: If total record size is less than ~7k (exactly UNIV_PAGE_SIZE/2 - 200) than the record is stored on page, all fields including *BLOB, *TEXT. If total record size is more than 7k

Is there a way to populate a MySQL 5.7 table with data from a json file with line breaks on Win7?

自作多情 提交于 2019-12-06 01:38:18
I have following example json file and I'm trying to populate a MySQL table with it. Since MySQL 5.7 supports json as a native datatype I thought this shouldn't be a problem, but MySQL's json validator seems to have a problem with the line breaks inside the file. As soon as I get rid of all line breaks and write my example file in one line, it works perfectly. [ { "somestuff": [ { "field1": "val1", "field2": 17, "field3": 27, "field4": 42, "field5": 73 }, { "field1": "val2", "field2": 3, "field3": 12, "field4": 13, "field5": 100 } ], "field0": "image", "path": "some path" } ] I know json

MySQL nested JSON column search and extract sub JSON

两盒软妹~` 提交于 2019-12-05 03:27:20
I have a MySQL table authors with columns id , name and published_books . In this, published_books is a JSON column. With sample data, id | name | published_books ----------------------------------------------------------------------- 1 | Tina | { | | "17e9bf8f": { | | "name": "Book 1", | | "tags": [ | | "self Help", | | "Social" | | ], | | "language": "English", | | "release_date": "2017-05-01" | | }, | | "8e8b2470": { | | "name": "Book 2", | | "tags": [ | | "Inspirational" | | ], | | "language": "English", | | "release_date": "2017-05-01" | | } | | } -----------------------------------------

Will this be stored on page?

你说的曾经没有我的故事 提交于 2019-12-04 20:00:19
http://dev.mysql.com/doc/refman/5.7/en/innodb-row-format-dynamic.html Can someone explain depends on the page size and the total size of the row ? If I use InnoDB and keep the default settings, then create a table with 60 bytes + a MEDIUMTEXT with 10kb data , will the MEDIUMTEXT be stored on page or off page? If total record size is less than ~7k (exactly UNIV_PAGE_SIZE/2 - 200) than the record is stored on page, all fields including *BLOB, *TEXT. If total record size is more than 7k than only 768 bytes of each *BLOB field values are stored on page. The remaining page of the field is stored in

MySQL select where JSON field property has value

情到浓时终转凉″ 提交于 2019-12-04 17:28:19
问题 How to write a basic MySQL query that has a WHERE on a property within a JSON data-type field? I don't see basic where clause q for json fields on SO. Something like this, but of course these dont work: SELECT * from my_table where meta_data->name = 'bob'; SELECT * from my_table where meta_data[name] IS NOT NULL; 回答1: Some examples of how to query a json data type field: SELECT * FROM users WHERE JSON_EXTRACT(meta_data, "$.first_name") = 'bob'; SELECT * FROM users WHERE JSON_EXTRACT(meta_data

Where is MySQL 5.7 my.cnf file?

纵然是瞬间 提交于 2019-12-03 04:28:56
问题 In Ubuntu I had my.cnf file of MySQL 5.6 in /etc/my.cnf . But I can't find the same file of MySQL 5.7. From where can I find that? I did a find in entire / (root). But I couldn't find it anywhere. Any clues? I'm trying to set max_connections value. 回答1: In MySQL 5.7, the default cnf is at: /etc/mysql/mysql.conf.d/mysqld.cnf 回答2: mysql --help printed below. Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf The following groups are