MySQL select where JSON field property has value

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, “$.age”) IS NOT NULL; SELECT * FROM users WHERE JSON_EXTRACT(meta_data, “$.accepted_policy”) = true; With mysql 5.7.9 + You can also just do this (shortcut for JSON_EXTRACT): SELECT * FROM … Read more

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

InnoDB: page_cleaner: 1000ms intended loop took 4013ms. The settings might not be optimal. (flushed=1438 and evicted=0, during the time.) The problem is typical of a MySQL instance where you have a high rate of changes to the database. By running your 5GB import, you’re creating dirty pages rapidly. As dirty pages are created, the page … Read more

What is the default root pasword for MySQL 5.7

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 … Read more

How to update JSON data type column in MySQL 5.7.10?

Thanks @wchiquito for pointing me right direction. I solved the problem. Here is how I did it. mysql> select * from t1; +—————————————-+——+ | data | id | +—————————————-+——+ | {“key1”: “value1”, “key2”: “VALUE2”} | 1 | | {“key2”: “VALUE2”} | 2 | | {“key2”: “VALUE2”} | 1 | | {“a”: “x”, “b”: “y”, “key2”: … Read more

How do I turn off the mysql password validation?

Here is what I do to remove the validate password plugin: Login to the mysql server as root mysql -h localhost -u root -p Run the following sql command: uninstall plugin validate_password; If last line doesn’t work (new mysql release), you should execute UNINSTALL COMPONENT ‘file://component_validate_password’; I would not recommend this solution for a production … Read more

tech