Search Posts

Month: February 2018

How to create a pivot view in MariaDB from json keys?

how to – How to create a pivot view in MariaDB from json keys? I have a table like this: +——–+————–+———————–+ | hostid | hostName | attr | +——–+———-+—————————+ | 1 | host1 | {“cpu”: 1, “ram”: 2} | +——–+————–+———————–+ | 2 | host2 | {“cpu”: 2, “ram”: 1} | +——–+————–+———————–+ | 3 | host3 | {“cpu”: 1, “ram”: 5} | +——–+————–+———————–+ | 4 | host4 | {“cpu”: 3, “ram”: 7} | +——–+————–+———————–+ I would […]

Unable to Start Mariadb on Ubuntu Container

how to – Unable to Start Mariadb on Ubuntu Container I Install mariadb-server on my ubuntu image container, when I want start mysql service it fails, the error.log file contains: 180228 16:41:24 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB. 180228 16:41:24 [Note] InnoDB: Using mutexes to ref count buffer pool pages 180228 16:41:24 [Note] InnoDB: […]

How can i add a "tag"-system to my account-system

how to – How can i add a "tag"-system to my account-system I’m trying to create Account-/Usersystem. My Problem is, i need a system that handles multiple users with the same username (each on has a specific id), but the users must can loggin! So… I think a “tag” system like that from Discord is nice. A four digit number, so that the user can login as “Max#1234”. Great! But the problem is, how can […]

What are some practical use cases for memory tables?

how to – What are some practical use cases for memory tables? Trying to learn mysql and having tons of other material to learn, I’m considering skipping memory tables, since they have many special characteristics to consider especially that they vanish, after server restart. In production environments, what are they used for in practice? Source: Stackoverflow MariaDB

Mysql inserts/update different decimal value

how to – Mysql inserts/update different decimal value I have a very strange case where mariaDB (mysql) inserts (or updates) a different decimal value. In the example below I want to insert the value ‘387507.65’ but in mysql it is registered as ‘387507.66’. If I use a different amount, say without the ‘3’, then it is registered fine. As an example: CREATE TABLE IF NOT EXISTS tbltest ( ID int(11) NOT NULL AUTO_INCREMENT, admin_id int(11) […]

How to let query the word with ‘ and without ‘ the same?

how to – How to let query the word with ‘ and without ‘ the same? I want to search a word from the database with single quote like a word can’t and if I search a word like cant without single quote, can’t still be displayed. Maybe there is an error with my query LIKE. <?php // Attempt search query execution try{ if(isset($_REQUEST[‘term’])){ // create prepared statement $sql = “SELECT * FROM countries WHERE […]

In objection js i am trying to set a role and receiveng error

how to – In objection js i am trying to set a role and receiveng error here is my code (node:10188) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: insert into user (email, name, password, role, username) values (‘[email protected]’, ‘chack’, ‘password’, ‘user’, ‘kkkp’) – ER_BAD_FIELD_ERROR: Unknown column ‘role’ in ‘field list’ (node:10188) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a […]

Update null field from same field if not null

how to – Update null field from same field if not null I want to update all NULL PlayerId field with existing PlayerId matching the exact same Name into the same table I have for the same Name some NULL PlayerID and some with the good value : SELECT count(*) as c, Name, PlayerId FROM my_table WHERE Name = ‘John,Doh’ GROUP BY PlayerId order by c ASC; +—+———–+————-+ | c | Name | PlayerId | […]

SpringBoot MySQL JDBC Unable to create initial connections of pool

how to – SpringBoot MySQL JDBC Unable to create initial connections of pool Good day! I have a simple springboot application with mysql jdbc repository. I have properties for connect to DB spring.datasource.url=jdbc:mysql://*:3306/*?useSSL=false spring.datasource.username=* spring.datasource.password=* spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.initialize=true spring.datasource.dbcp2.validation-query=SELECT 1 spring.datasource.dbcp2.max-total=1 My test DB has only max 10 connections for user. When I use console SHOW STATUS WHERE variable_name = ‘threads_connected’; I can see that now DB has 5 connections only but when I try to […]

Next Page »