Sample Header Ad - 728x90

Database Administrators

Q&A for database professionals who wish to improve their database skills

Latest Questions

1 votes
2 answers
3120 views
Connection rejected on MySQL server (error 10060)
I have a small database on a server in my LAN that I try to access remotely via ODBC. Currently, I am making a program in Visual Basic to access, retrieve and display data from the server to an Excel file. Sometimes, the program will stop working all of a sudden and display an error message: >[MySQL...
I have a small database on a server in my LAN that I try to access remotely via ODBC. Currently, I am making a program in Visual Basic to access, retrieve and display data from the server to an Excel file. Sometimes, the program will stop working all of a sudden and display an error message: >[MySQL][ODBC 8.0(w) Driver]Can't connect to MySQL server on '{the IP address of the server with the correct port}'(10060) My troubleshooting efforts so far: - Tried to connect with the ODBC connector remotely: Failed - Tried to connect with MySQL Workbench and access the Database remotely: Failed - Tried to connect to the Database locally with HeidiSQL: Can connect without a problem - Tried to connect to the Database locally with MySQL workbench: Can connect without a problem With HeidiSQL, went to Host -> Status and checked the "Connections" value : Increase at every connection attempt. Checked the Connection_errors_xxx fields : all are 0 and never change. I don't think the problem is the connection string as the program worked well before and nothing changed since. My guess is that either a firewall or the database itself is blocking incoming connections from my computer for some reason. I tried to search if there was a way of having details on incoming connection requests (like in a Log file) but couldn't find anything. The only way I found to "resolve" the problem is to wait some time (maybe a couple of hours) and then try to connect again. Would anyone have an idea of where I could find the reason or some explanation on why this problem is happening and how to fix it?
SuperRamen (13 rep)
Feb 8, 2023, 04:12 AM • Last activity: Mar 3, 2025, 10:29 PM
0 votes
1 answers
507 views
Faster query time but slower response time in 11.4 vs 10.3
I am trying to do a migration for a sever upgrade. The current live system is a Win 2016 server with MariaDB 10.3 on it. The new system is Win 2022 with MariaDB 11.4. Everything is virtual running on VMWare. I have set up the new system, restored a backup of the live database and done some performan...
I am trying to do a migration for a sever upgrade. The current live system is a Win 2016 server with MariaDB 10.3 on it. The new system is Win 2022 with MariaDB 11.4. Everything is virtual running on VMWare. I have set up the new system, restored a backup of the live database and done some performance testing. I'm using the latest version of HeidiSQL to run my queries. In order to have a fair comparison I have set up a test VM which is Win 2022 and MariaDB 10.3. Both VMs are on the same host and have the same specs. And both are using the same restore point. Everything is the same except the MariaDB version. What I'm seeing in profiler on Heidi is the query run time of my test query on the 11.4 VM is much shorter, around a a third of the time of the 10.3 test box. (around 0.2 vs 0.6). Which is great. But the total query time reported by HeidiSQL is longer by around 0.7 sec. (Around 3 seconds on the 11.4 box and 2.3 seconds on the 10.3 box.) I have run the query multiple times so the data is in memory and I can get an average. Once the data is in memory the run times are fairly stable on both test VMs. I'm using Solarwinds DBA (only against 11.4) and the majority of the time is recorded as "sending data", which seems to cover multiple things. But this is apparently the same with most queries, and because I can't find a way to drill down any further isn't very helpful. I did find that switching on the profiler in HeidiSQL on the 11.4 box added around 0.5 secs to the total run time, which it didn't on the 10.3. So something has changed there between versions. (Heidi is the same version on both test VMs). Does anyone know why I would be getting a faster query time but slower overall response time on 11.4? I can't really put the new server live knowing it is about 30% slower and also not knowing why! I'm not a DBA and I've reached the limits of knowing where to look to find where the extra time is being used. It would appear to be environmental except I can't see anything to make the VMs behave differently. The cache hit is 100%, there is no sign of slow disk activity, the queries are being run locally so no network involved. Any ideas would be gratefully received. Rich. EDIT: Here is the SQL.
`
SELECT
    todo.customer_requested 'Callback Requested',
    app.id 'Client Lead ID',
    (select cd.CodeName from theremortgagepeople.companydetails cd where cd.id = app.OwningCompanyId limit 1) 'Lead Owner',
    concat(app.FirstName, ' ', app.LastName) 'Client',
    (select tt.todoType from contacts.tmtodotype tt where tt.id = todo.todotype limit 1) 'Call Reason',
    todo.duedate 'Due',
    (select u.DisplayName from theremortgagepeople.user u where u.id = todo.user_id limit 1) 'Owner',
    (select ls.Description from contacts.leadsource ls where ls.id = app.LeadSourceId limit 1) 'Lead Source',
    app.CreatedDate 'Lead Loaded',
    todo.completed_date 'Completed',
    (select u.DisplayName from theremortgagepeople.user u where u.id = todo.completed_by limit 1) 'Completed By',
    (select cr.reason from contacts.todoclosurereasons cr where cr.id = todo.closureReasonId limit 1) 'Completed Reason',
    (select co.outcome from contacts.tmcalloutcome co where co.id = todo.calloutcome limit 1) 'Call Outcome',
    (select tr.reason from contacts.tmturndownreason tr where tr.id = todo.turndownreason limit 1) 'Turndown Reason',
    todo.createddate 'Created Date',
    (select u.DisplayName from theremortgagepeople.user u where u.id = todo.createdby limit 1) 'Created By',
	iq.ercDate,
    (select co.outcome from contacts.tmcalloutcome co where co.id = todo.secondOutcomeId limit 1) 'Sec Outcome'

FROM contacts.tmtodolist todo
inner join contacts.applicant app on todo.applicant_id = app.id
left join contacts.initialquestions iq on app.id = iq.applicantId
where todo.completed 
AND (todo.completed_date IS NOT NULL AND (CONVERT(todo.completed_date, date) >= '2024-07-01 00:00:00Z'))
AND (todo.completed_date IS NOT NULL AND (CONVERT(todo.completed_date, date) <= '2024-07-31 00:00:00Z'))
AND app.istest = false
AND (app.owningcompanyid is not null and app.owningcompanyid in (1,2,3))
order by todo.completed_date asc;
`
rb305798 (1 rep)
Sep 17, 2024, 12:00 PM • Last activity: Sep 20, 2024, 12:23 PM
0 votes
0 answers
174 views
Mariadb can't enforce charset and collation to clients
I'm trying to force clients to use utf8mb4_unicode_520_ci and uft8mb4. I tried to add this to all my galera cluster nodes [mysqld] ... collation-server = utf8mb4_unicode_520_ci init-connect='SET NAMES utf8mb4' character-set-server = utf8mb4 character-set-client-handshake = FALSE skip-character-set-c...
I'm trying to force clients to use utf8mb4_unicode_520_ci and uft8mb4. I tried to add this to all my galera cluster nodes [mysqld] ... collation-server = utf8mb4_unicode_520_ci init-connect='SET NAMES utf8mb4' character-set-server = utf8mb4 character-set-client-handshake = FALSE skip-character-set-client-handshake = 1 ... However when I connect with HeidiSQL or mysql-connector-python it never uses it and even says collation-database: latin1_swedish_ci Using Mariadb 10.11.7 with galera cluster and checking with SHOW VARIABLES LIKE '%collation%'; Altered my db with
TABLE XXXX CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;
I want to forbid any client to use different values than the server
Freedo (208 rep)
May 3, 2024, 08:10 AM • Last activity: May 3, 2024, 02:38 PM
1 votes
1 answers
41 views
MySQL Tennis Ladder View Creation Question
I am creating a Tennis Ladder VIEW using MySQL and wish to do the following: - Properly create a view that includes: **All player's names** - These player names will come from the table: **User** - using the field: **name** Here is a very simple structure of the database [![Tennis Ladder ERD][1]][1]...
I am creating a Tennis Ladder VIEW using MySQL and wish to do the following: - Properly create a view that includes: **All player's names** - These player names will come from the table: **User** - using the field: **name** Here is a very simple structure of the database Tennis Ladder ERD ...and here is the view query I have so far (query generated from HeidiSQL):
select lm.id AS id,
l.ladderName AS ladderName,
l.ladderType AS ladderType,
l.manager_id AS manager_id,
lm.match_round AS match_round,
lm.match_court_scheduled AS match_court_scheduled,
lm.match_datetime_scheduled AS match_datetime_scheduled,
lm.match_date_completed AS match_date_completed,
lm.match_winner AS match_winner,
lm.team1_user1_id AS team1_user1_id,
lm.team2_user1_id AS team2_user1_id 

from (((ladder_matches lm 
left join ladder l on((lm.ladder_id = l.id))) 
left join ladder_users lu on((lm.team1_user1_id = lu.id))) 
left join users u on((lu.user_id = u.id))) 
order by lm.id
Reno Kendo (21 rep)
Dec 30, 2023, 10:58 PM • Last activity: Dec 31, 2023, 05:57 AM
0 votes
1 answers
46 views
Join two tables with similar columns
I hva two tables as is: * Table *univers*: | client |commercial| | -------- | -------------- | | Axel| Tony | | Mike| Jhon| | Chris| Jhon| * Table transactions | frclient | toclient |commission| | -------- | -------- |----------| | Axel | NA |10 | | Mike | NA |8 | | NA | Mike |15 | | Axel | NA |4 |...
I hva two tables as is: * Table *univers*: | client |commercial| | -------- | -------------- | | Axel| Tony | | Mike| Jhon| | Chris| Jhon| * Table transactions | frclient | toclient |commission| | -------- | -------- |----------| | Axel | NA |10 | | Mike | NA |8 | | NA | Mike |15 | | Axel | NA |4 | | NA| Chris|5 | | Chris| NA |5 | Now, I would like to be able to have the total commissions generated by Jhon and Tony's clients, a bit like: | commercials| commissions | | -------- | -------------- | | Jhon| 33| | Tony| 14 | The only element that links the *univers* table and the *transactions* table are the customer IDs, namely their names, nothing else. How can I proceed please? THANKS.
COPEGUEST (33 rep)
Jun 14, 2023, 04:25 PM • Last activity: Jun 14, 2023, 06:24 PM
0 votes
0 answers
134 views
Error with CREATE DEFINER = root @ PROCEDURE
im getting an error in this script for my project. Im using MariaDB with HeidiSQL v12.2. I dont know what its happen with this script but the error occur at line 85. Sorry for my English. ```sql CREATE DEFINER=`root`@`%` PROCEDURE `SP_KPI_TIEMPO_SOLUCION`( in pinicio datetime ,in pfin datetime ) BEG...
im getting an error in this script for my project. Im using MariaDB with HeidiSQL v12.2. I dont know what its happen with this script but the error occur at line 85. Sorry for my English.
CREATE DEFINER=root@% PROCEDURE SP_KPI_TIEMPO_SOLUCION(
in pinicio datetime
,in pfin datetime
)
BEGIN
 select
sum(contador) as Total_Tickets
,sum(cumple) as Total_Cumple_SLA
,round(sum(cumple) / sum(contador) * 100) Kpi
/*,(
select color from colorkpi 
where
sum(cumple) / sum(contador)*100 >= rango1 and sum(cumple) / sum(contador)*1001
/*and tt.state_id in (2,3,10,13,14)*/
and (e.type_id=3
or tt.state_id=14)) as cierre
,
case
when t.ticket_state_id=13 then 1 /*Cierre Técnico se considera como 1 cumple*/
else
case
when
s.solution_time>total_hh(DATE_FORMAT(t.create_time, "%Y,%m,%d %H,%i"), DATE_FORMAT((
select min(tt.create_time) 
from ticket_history tt
,ticket_state e
where tt.ticket_id=t.id
and tt.article_id is not null
and tt.state_id=e.id
and tt.state_id1
/*and tt.state_id in (2,3,10,13,14)*/
and (e.type_id=3
or tt.state_id=14) -- se agrega el esatdo solucionado como cerrado
), "%Y,%m,%d %H,%i")) then 1
else 0 end 
end
as Cumple

,s.solution_time

,total_hh(DATE_FORMAT(t.create_time, "%Y,%m,%d %H,%i"), DATE_FORMAT((
select min(tt.create_time) 
from ticket_history tt
,ticket_state e
where tt.ticket_id=t.id
and tt.article_id is not null
and tt.state_id=e.id
and tt.state_id1
/*and tt.state_id in (2,3,10,13,14)*/
and e.type_id=3
), "%Y,%m,%d %H,%i")) tiemporeal
from ticket t
,sla s
,ticket_state te
where
t.create_time between /*'2018/04/01 00:00'*/pinicio and /*'2018/04/30 23:59'*/pfin + interval 1439 minute 
and t.type_id in (1,8)/*8: Requerimiento 1:Indicente*/
and t.sla_id=s.id
and t.queue_id in (8) /*Solo mesa de ayuda*/
/*and t.ticket_state_id in (2,3,10,13,14,9) /*Estado Cerrados Solamente*/
and t.ticket_state_id=te.id
and te.type_id in (3,7) /* 3, cerrados - 7, fusionados*/
and te.valid_id=1
order by ticket    

)
a;

END
Hope someone can help me, Thanks!
Eduardo Estay Atenas (33 rep)
Jan 16, 2023, 07:57 PM • Last activity: Jan 16, 2023, 08:03 PM
0 votes
1 answers
45 views
Using the correct JOIN
I am trying to create an app for the salespeople who work for my company to keep track of their sales/commission When a salesperson brings on an account, their name is noted on the account and the table might look like Table B | Account | Salesperson | |:---------:|:-----------:| | Account A | A | |...
I am trying to create an app for the salespeople who work for my company to keep track of their sales/commission When a salesperson brings on an account, their name is noted on the account and the table might look like Table B | Account | Salesperson | |:---------:|:-----------:| | Account A | A | | Account B | B | | Account C | B | | Account D | A | Then the jobs list might look like Table A | Account | Job details | Price | |:---------:|:-----------:|:-----:| | Account A | xyz | £x | | Account B | xyz | £x | | Account C | xyz | £x | | Account D | xyz | £x | | Account A | xyz | £x | | Account C | xyz | £x | I am looking for a way to filter the results of table A based on the sales person noted next to the Account in Table B I have looked at all of the JOIN options but am unsure I am using the correct one. I have opted, currently, for SELECT J.*, A.Company, A.SalesPerson FROM TableA A INNER JOIN TableB B ON A.Account= B.Account Where A.Salesperson = "B" This seems to work for the time being, however I am unsure wether this is the best Join to use and whether it will last the test of time
PaulMcF87 (177 rep)
Nov 29, 2022, 03:50 PM • Last activity: Nov 29, 2022, 11:45 PM
0 votes
0 answers
1018 views
HeidiSQL, how to export user definition
I am using MariaDB version 10.5.9.0 on Windows version 10.0.19041.928 with HeidiSQL version 11.0.0.5919 I have exported the database structure which includes the tables, stored procedures and data. I also want to export the user I created to access the database. In HeidiSQL I select the **Tools** to...
I am using MariaDB version 10.5.9.0 on Windows version 10.0.19041.928 with HeidiSQL version 11.0.0.5919 I have exported the database structure which includes the tables, stored procedures and data. I also want to export the user I created to access the database. In HeidiSQL I select the **Tools** top line menu option, then **Export database as SQL**, I check the database I want to export in this case called **training**, in the **SQL export** tab I check the **Drop** checkboxes for **Database(s)** and **Table(s)**, the **Data:** drop down is set to **Insert**, **Output:** is **Single.sql file**, **Filename:** is supplied the location and name to export to. From the **mysql** schema I check the **user** table, then I click the **Export** button. The SQL file created contains the structure of the user table but no inserts present where as the training database contains all the inserts and the stored procedures. Is there a reason why the user inserts are missing? I want to use the SQL file as a complete set-up.
SPlatten (149 rep)
May 5, 2021, 09:51 AM • Last activity: May 21, 2021, 08:08 PM
0 votes
1 answers
224 views
How to insert '1001-01-01 00:00:00' into MariaDB when altering a table?
I created a table in HeidiSQL: CREATE TABLE `publish_dt` ( `ID` BIGINT(20) NOT NULL AUTO_INCREMENT, `TS` DATETIME NULL DEFAULT NULL, `Text` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_unicode_ci', PRIMARY KEY (`ID`) USING BTREE ) COLLATE='utf8mb4_unicode_ci' ENGINE=InnoDB AUTO_INCREMENT=2 ; Then I insert...
I created a table in HeidiSQL: CREATE TABLE publish_dt ( ID BIGINT(20) NOT NULL AUTO_INCREMENT, TS DATETIME NULL DEFAULT NULL, Text VARCHAR(50) NOT NULL COLLATE 'utf8mb4_unicode_ci', PRIMARY KEY (ID) USING BTREE ) COLLATE='utf8mb4_unicode_ci' ENGINE=InnoDB AUTO_INCREMENT=2 ; Then I insert some data into the table, e.g. with INSERT INTO publish_dt (Text) VALUES ('Hello') Then I want to change TS column to non-NULL with a default of '1001-01-01 00:00:00'. I tried to do this in HeidiSQL, it produces the following ALTER TABLE query: ALTER TABLE publish_dt CHANGE COLUMN TS TS DATETIME NOT NULL DEFAULT '1001-01-01 00:00:00' AFTER ID; However, when I try to save changes in HeidiSQL, I receive the following error from the DB: SQL Error (1265): Data truncated for column 'TS' at row 1 Could you, please, clarify why this error happens (I couldn't find the same case with DATETIME on the internet) and how to work it around? Reason for asking: MariaDB documentation says > MariaDB stores values that use the DATETIME data type in a format that > supports values between 1000-01-01 00:00:00.000000 and 9999-12-31 > 23:59:59.999999.
Serge Rogatch (115 rep)
Jun 22, 2020, 12:45 PM • Last activity: Jun 23, 2020, 04:23 PM
1 votes
2 answers
5599 views
trying to connect to MSSQL server using named pipe in HeidiSQL
I'm trying to connect to a MSSQL server in our office from my local desktop using HeidiSQL. I am able to connect to this server with both SQL Server Management Studio and ODBC with no problems. The connection uses integrated Windows authentication. I installed the MS OLE DB SQL 18.2.2.0 x64 driver....
I'm trying to connect to a MSSQL server in our office from my local desktop using HeidiSQL. I am able to connect to this server with both SQL Server Management Studio and ODBC with no problems. The connection uses integrated Windows authentication. I installed the MS OLE DB SQL 18.2.2.0 x64 driver. My settings in HeidiSQL are: **network type:** Microsoft SQL Server (named pipe) **library:** MSOLEDBSQL **hostname:** \ use windows authentication is checked every time I try to connect I get: > SQL Error (0): SQL Server Network Interfaces: Server doesn't support requested protocol [xFFFFFFFF] Login timeout expired It doesn't tell me what protocol is being used, and I don't see any options to change it. Does "protocol" in this case refer to the library? Is there some way to change the protocol in Heidi?
raphael75 (244 rep)
Aug 6, 2019, 07:45 PM • Last activity: Aug 7, 2019, 06:30 PM
0 votes
1 answers
5233 views
SQL: How to ask for multiple counts from the same table within a join
Trying to find 3 separate counts within one column of a table, each with separate WHERE clauses. I've got 2 tables in the query, so one join. Thought this looked correct but it will not run: SELECT stores.caption, COUNT ( WHEN tasks.created_at BETWEEN '2019-04-01' AND '2019-04-30' AND tasks.deleted_...
Trying to find 3 separate counts within one column of a table, each with separate WHERE clauses. I've got 2 tables in the query, so one join. Thought this looked correct but it will not run: SELECT stores.caption, COUNT ( WHEN tasks.created_at BETWEEN '2019-04-01' AND '2019-04-30' AND tasks.deleted_at IS NULL) AS TaskTotal , COUNT ( WHEN tasks.created_at BETWEEN '2019-04-01' AND '2019-04-30' AND tasks.deleted_at IS NULL AND tasks.completed_at IS NULL) AS TaskOutstanding, COUNT ( WHEN tasks.created_at BETWEEN '2019-04-01' AND '2019-04-30' AND tasks.deleted_at IS NULL AND tasks.completed_at IS NULL AND tasks.deadline < '2019-05-16') AS TaskOverdue FROM tasks FULL JOIN stores ON tasks.store_id=stores.id GROUP BY stores.caption;
mtug94 (1 rep)
May 16, 2019, 11:03 AM • Last activity: May 16, 2019, 08:05 PM
0 votes
0 answers
1795 views
How can I import table records in HeidiSql?
Im using HeidiSQL and I have imported database from another one. All table structures are imported but not records. I want to import all records for all tables. I have tried to import records for one table using import csv option but its inserting only one record and through error.
Im using HeidiSQL and I have imported database from another one. All table structures are imported but not records. I want to import all records for all tables. I have tried to import records for one table using import csv option but its inserting only one record and through error.
user177578 (1 rep)
Apr 18, 2019, 08:00 AM • Last activity: Apr 18, 2019, 05:24 PM
Showing page 1 of 12 total questions