mysql-5.7

Error setting up MySQL: Table 'mysql.plugin' doesn't exist

点点圈 提交于 2020-02-24 03:40:32
问题 I have a MySQL 5.7 instance running without problems on Ubuntu 16, but when i try to install any other package or try to update existing ones through apt-get, i get the following error: # apt-get upgrade Setting up mysql-server-5.7 (5.7.20-0ubuntu0.16.04.1) ... Checking if update is needed. Checking server version. Running queries to upgrade MySQL server. mysql_upgrade: [ERROR] 1146: Table 'mysql.plugin' doesn't exist mysql_upgrade failed with exit status 5 dpkg: error processing package

List all array elements of a MySQL JSON field

半城伤御伤魂 提交于 2020-01-14 18:53:05
问题 I have a JSON field to save post's tags. id:1, content:'...', tags: ["tag_1", "tag_2"] id:2, content:'...', tags: ["tag_3", "tag_2"] id:3, content:'...', tags: ["tag_1", "tag_2"] I just want to list all tags with their popularities (or even without them) something like this: tag_2: 3, tag_1: 2, tag_3: 1 回答1: Here's the setup: create table t ( id serial primary key, content json); insert into t set content = '{"tags": ["tag_1", "tag_2"]}'; insert into t set content = '{"tags": ["tag_3", "tag_2

How to create a six character password in MySQL 5.7

怎甘沉沦 提交于 2020-01-11 15:29:07
问题 I need to create a user with a six character password in new MySQL on my mac. I know that the lowest setting in 5.7 will allows only eight characters. Is there any way to go around that? I type in CREATE USER 'newsier'@'localhost' IDENTIFIED BY 'special' It outputs the error ERROR 1819 (HY000): Your password does not satisfy the current policy requirements 回答1: You are using the password validation plugin. By default it only allows 8 characters and longer passwords. Because it can't check the

MySQL, Select records based on values in JSON array

允我心安 提交于 2020-01-11 10:42:15
问题 I'm still pretty new to handling JSON fields in MySQL. All the solutions I've come across deal with objects that have key/values; unable to find one that handles JSON arrays. Anyways, what I want to do is to be able to select all rows where the interestIds contain 2 in them. How do I do that? Thanks. Users table +----+-------------+ | id | interestIds | +----+-------------+ | 1 | [1, 2] | | 2 | [3, 2] | | 3 | [2, 4] | +----+-------------+ Sample test query: SET @userId = 2; SELECT * FROM

How to calculate amount of work performed by the page cleaner thread each second?

荒凉一梦 提交于 2020-01-06 05:22:12
问题 I try to tune InnoDB Buffer Pool Flushing parameters. In MySQL 5.7 manual innodb_lru_scan_depth * innodb_buffer_pool_instances = amount of work performed by the page cleaner thread each second My question is : How can I calculate the amount of work performed by the page cleaner thread each second? 回答1: Run the SQL command: SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_pages_flushed' Once every second. Compare the value to the previous second. The difference of that value from one second to the

Get count of continuous dates in mysql

自作多情 提交于 2020-01-05 04:21:06
问题 I have a requirement to get count of continuous dates in leaves table. CREATE TABLE leaves( id INT AUTO_INCREMENT PRIMARY KEY , employee_id INT NOT NULL, leave_request_id INT NOT NULL, leave_date DATE NOT NULL, start_time time NOT NULL DEFAULT '00:00:00', end_time time NOT NULL DEFAULT '00:00:00' ); INSERT INTO `leaves` (`id`, `leave_request_id`, `leave_date`, `employee_id`, `start_time`, `end_time`) VALUES (NULL, '1', '2019-10-01', '2', '09:00:00.000000', '18:00:00.000000'), (NULL, '1',

How to disable only_full_group_by option in Laravel

大城市里の小女人 提交于 2020-01-03 16:47:39
问题 I am new to laravel and I am having an issue with DB problem. I have disabled 'only_full_group_by' sql_mode by editing /etc/mysql/my.cnf file. And I checked sql_mode for both global and session using SELECT @@GLOBAL.sql_mode; and SELECT @@SESSION.sql_mode; and confirmed that sql_mode no longer has only_full_group_by . However, when I make a request through postman, it gives me the error saying this is incompatible with sql_mode=only_full_group_by . I am so confused. Why do I get this error

Which collation to use so that `ş` and `s` are treated as unique values?

北城余情 提交于 2019-12-31 06:42:06
问题 The issue is that ş and s are interpreted by MySQL as identical values. I'm new to MySQL, so I have no idea which collations would view them as unique. The collations that I've tried using which don't work are: utf8_general_ci utf8_unicode_520_ci utf8mb4_unicode_ci utf8mb4_unicode_520_ci Does anybody know which collation to use? P.S. I also really need the collation to interpret emojis and other non-Latin characters, and, to my knowledge of MySQL and collations, the only collation able to do

ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause … this is incompatible with sql_mode=only_full_group_by [duplicate]

痴心易碎 提交于 2019-12-25 07:50:52
问题 This question already has answers here : Retrieving the last record in each group - MySQL (26 answers) Closed 3 years ago . I am using MYSQL 5.7. I want to get the recent rows with distinct device_id . I tried these queries: Query 1 SELECT `table`.`id`, `table`.`device_id` FROM `table` WHERE (id IN (SELECT id FROM (SELECT * FROM table ORDER BY date_modified DESC) AS last_modified GROUP BY device_id) and device_id <> ''); +----+------------------+ | id | device_id | +----+------------------+ |

Brew postinstall mysql@5.7 complaining about data directory not empty when it is empty

戏子无情 提交于 2019-12-25 01:14:16
问题 Having a lot of trouble installing mysql 5.7 on Mac Mojave, (ran 'brew install mysql@5.7') on initial install, got msg saying postinstall was not completed successfully (please see msg below). So, after I delete everything in the directory /usr/local/var/mysql (which mysql says is not empty), I STILL get same message when re-running postinstall command ... (which is quite annoying seems MySQL is populating the data dir then complaining it is not empty?!) [08:02:48][~/tmp]#brew postinstall