Sample Header Ad - 728x90

Database Administrators

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

Latest Questions

0 votes
1 answers
343 views
Unknown source of high number of connections
In MySQL/Aurora I see from time to time a spike in connections number (from about 100 to 4000): [![enter image description here][1]][1] MySQL [doc][2] says: > Connections > > The number of connection attempts (successful or not) to the MySQL server. So I was thinking those coming from failed connect...
In MySQL/Aurora I see from time to time a spike in connections number (from about 100 to 4000): enter image description here MySQL doc says: > Connections > > The number of connection attempts (successful or not) to the MySQL server. So I was thinking those coming from failed connection, however I don't see failures: MySQL [(none)]> SHOW GLOBAL STATUS like 'Conn%'; +-----------------------------------+----------+ | Variable_name | Value | +-----------------------------------+----------+ | Connection_errors_accept | 0 | | Connection_errors_internal | 0 | | Connection_errors_max_connections | 0 | | Connection_errors_peer_address | 0 | | Connection_errors_select | 0 | | Connection_errors_tcpwrap | 0 | | Connections | 34388970 | +-----------------------------------+----------+ 7 rows in set (0.00 sec) MySQL [(none)]> show global variables like '%conn%'; +-----------------------------------------------+-------------------+ | Variable_name | Value | +-----------------------------------------------+-------------------+ | aurora_max_connections_limit | 16000 | | connect_timeout | 10 | | disconnect_on_expired_password | ON | | init_connect | | | max_connect_errors | 100 | | max_connections | 4000 | | max_user_connections | 0 | | performance_schema_session_connect_attrs_size | 512 | +-----------------------------------------------+-------------------+ I would very much like to understand what those are and when they are coming from.
Nir (529 rep)
Oct 4, 2020, 08:45 AM • Last activity: Aug 4, 2025, 03:10 AM
0 votes
1 answers
141 views
MariaDB (RDS) going temporarily offline (with memory drop)
We have an issue with a database of ours on RDS running MariaDB 10.4.8 on a t3-large instance type. For the past week or so, it's been sporadically inaccessible with no errors I can find. During the minute or two that it's down I can't run 'show process list' it just hangs. It fixes itself and is ba...
We have an issue with a database of ours on RDS running MariaDB 10.4.8 on a t3-large instance type. For the past week or so, it's been sporadically inaccessible with no errors I can find. During the minute or two that it's down I can't run 'show process list' it just hangs. It fixes itself and is back working within a few minutes. When it comes back it looks like it has a lot of connections and queries to catch up on. Changed params from default: ft_min_word_len 1 innodb_buffer_pool_size {DBInstanceClassMemory*17/20} innodb_ft_enable_stopword 1 innodb_ft_min_token_size 1 log_bin_trust_function_creators 1 max_statement_time 30 sql_mode NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION ## Freeable Memory: enter image description here ## Swap space: enter image description here ## Performance Insights: enter image description here If there any way to find out what's causing it. Is it not enough free memory? What's a normal threshold to be running to?
Edd Turtle (113 rep)
Nov 16, 2020, 02:54 PM • Last activity: Aug 1, 2025, 09:01 AM
2 votes
1 answers
2051 views
SSMS cannot connect to SQL Server 2022 - Internal Error
I'm trying to connect (on the same host) from SSMS 19.0.2 to a newly installed SQL Server 2022 developer edition instance. I am getting a weird internal error: ``` =================================== Internal connection fatal error. Error state: 15, Token : 23 (Microsoft.Data.SqlClient) ------------...
I'm trying to connect (on the same host) from SSMS 19.0.2 to a newly installed SQL Server 2022 developer edition instance. I am getting a weird internal error:
===================================

Internal connection fatal error. Error state: 15, Token : 23 (Microsoft.Data.SqlClient)

------------------------------
Program Location:

   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at Microsoft.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
   at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover, Boolean isFirstTransparentAttempt, Boolean disableTnir)
   at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
   at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
   at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, ServerCertificateValidationCallback serverCallback, ClientCertificateRetrievalCallback clientCallback, DbConnectionPool pool, String accessToken, SqlClientOriginalNetworkAddressInfo originalNetworkAddressInfo, Boolean applyTransientFaultHandling)
   at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at Microsoft.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at Microsoft.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
   at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
   at Microsoft.Data.SqlClient.SqlConnection.Open()
   at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
   at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
I found [this](https://dba.stackexchange.com/questions/317116/microsoft-sql-server-2019-developer-edition-suddenly-throwing-internal-connectio) , and the answer suggests uninstalling KB5011048 (.Net Framework 4.8.1), but I do not have that version of .Net installed. Can someone point out what's wrong? *Edit:* I have made some progress. After fiddling with excluded port ranges, I now have SQL Server again listening on the default (1433) port. A Wireshark trace suggested that there was some sort of problem with a TLS handshake, so I changed the connection options to "Encrypt connection" and "Trust Server Certificate". Now I get a connection timeout in the post-login phase. If I use sqlcmd, the following happens:
> .\sqlcmd -S 'tcp:' -N true -C
read tcp 127.0.0.1:55499->127.0.0.1:1433: wsarecv: An existing connection was forcibly closed by the remote host.
read tcp 127.0.0.1:55499->127.0.0.1:1433: wsarecv: An existing connection was forcibly closed by the remote host.
In wireshark, I see TDS prelogin messages go back and forth, then the client sends what wireshark describes as a "TLS Exchange", to which the server sends a TCP ACK, and then closes the connection.
mikb (129 rep)
Apr 13, 2023, 12:33 AM • Last activity: Jul 21, 2025, 12:02 PM
0 votes
1 answers
139 views
MySQL Drop Federated Table When Remote Server is Down
We have a production database (MySQL 8.0) that has a federated table in it. The remote server had an IP address update, and whenever a client opens this DB, it takes forever (~5 minutes) since table information can not be retrieved... Our fix is to remove the table as it is no longer needed. Unfortu...
We have a production database (MySQL 8.0) that has a federated table in it. The remote server had an IP address update, and whenever a client opens this DB, it takes forever (~5 minutes) since table information can not be retrieved... Our fix is to remove the table as it is no longer needed. Unfortunately all the following have failed with forever running queries.
Looking at the process list they are in a state of "*Waiting for table metadata lock*":
1. DROP TABLE db.myfedtable;
2. ALTER TABLE db.myfedtable CONNECTION = 'valid connection string for updated IP';
3. ALTER TABLE db.myfedtable ENGINE = InnoDB;
We have also verified no processes or queries are trying to run against this table. We have tried restarting MySQL since the server connection has been lost. Our next steps is to try and setup a firewall to re-route traffic to the new server IP just so we can run a drop statement. Any ideas would be helpful here.
MadHatter (101 rep)
Nov 28, 2023, 10:26 PM • Last activity: Jul 21, 2025, 09:02 AM
1 votes
2 answers
143 views
Verify failed SQL Server connections to instances on a given server and email them
I am trying to monitor the SQL Server instances on standalone server / cluster server. I would like to setup something from commandline to check for connectivity to each SQL Server instance on the server. Wherever it fails to connect to an instance I would like to have an email (we have smtp server...
I am trying to monitor the SQL Server instances on standalone server / cluster server. I would like to setup something from commandline to check for connectivity to each SQL Server instance on the server. Wherever it fails to connect to an instance I would like to have an email (we have smtp server setup) sent to our DBA team. Each server is having more than 5 instances and we are unable to track them without customer complaining about connectivity, hence trying to be proactive. Can we try something like osql or sqlcmd?
Techflu (19 rep)
Jan 15, 2015, 11:49 AM • Last activity: Jul 19, 2025, 12:05 PM
0 votes
1 answers
161 views
Unable to create maintenance plan
When trying to create a maintenance plan locally on two prod servers through SSMS, I receive this error: [![Maintenance plan creation][1]][1] [1]: https://i.sstatic.net/Wh84N.png No such error occurs on my UAT system. They're all running SQL Server 2017 (14.0.3162.1), and they were all installed wit...
When trying to create a maintenance plan locally on two prod servers through SSMS, I receive this error: Maintenance plan creation No such error occurs on my UAT system. They're all running SQL Server 2017 (14.0.3162.1), and they were all installed with the same feature set. The UAT machine is Windows 10, while the prod servers are Windows Server 2016. Which components/features specifically need to be installed such that I can create a maintenance plan?
Franzl (101 rep)
Jun 30, 2019, 10:33 AM • Last activity: Jul 13, 2025, 04:05 PM
0 votes
1 answers
178 views
SQl connection to XAMP
i am trying to connect my database to XAMP . I got this error Warning: Use of undefined constant ID - assumed 'ID' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\Thairis\login.php on line 8 Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\...
i am trying to connect my database to XAMP . I got this error Warning: Use of undefined constant ID - assumed 'ID' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\Thairis\login.php on line 8 Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\Thairis\connectdb.php:27 Stack trace: #0 C:\xampp\htdocs\Thairis\login.php(11): include() #1 {main} thrown in C:\xampp\htdocs\Thairis\connectdb.php on line 27
tahir Mohammed (1 rep)
May 2, 2020, 08:42 PM • Last activity: Jun 28, 2025, 08:07 AM
1 votes
1 answers
112 views
DBA but cannot connect to SQL Instance - "User does not have permission to perform this action (Error 15427)"
I am a DBA with local sysadmin rights, and sysadmin rights on the SQL instance. Up until recently, i have been able to connect to a SQL Instance without issue. All i am trying to do is connect to a SQL Instance using SSMS. Nothing fancy here - just normal login with Windows Authentication. Although...
I am a DBA with local sysadmin rights, and sysadmin rights on the SQL instance. Up until recently, i have been able to connect to a SQL Instance without issue. All i am trying to do is connect to a SQL Instance using SSMS. Nothing fancy here - just normal login with Windows Authentication. Although this also occurs if using SQL Authentication. Now i am getting an error message "User does not have permission to perform this action (Error 15427)". My colleagues whom are also DBA's receive this same error. And the default SQL 'sa' account also receives this error. I have never seen something like this before and am having difficulty finding helpful responses as they all seem to be focusing on the error number rather than the symptoms i am experiencing. I can confirm that all Protocols are enabled and ordered as per our environment, and i can confirm that there have been no changes to this SQL Instance (that i am aware of). I can confirm the SQL Services are running and that permissions for the account running it have not changed (it is a gMSA). The saving grace is that this is in our Test environment so no Production data is at risk here. So i also have a great deal of flexibility in things i can try to resolve. Is someone able to please help me figure out what is going on here? Happy to provide further details if required, SQL Server: 2016, Version: 13.0.6435.1, Edition: Developer, Product Level: SP3, Cheers! Update - further testing/checks We have a user who is NOT a DBA. They are in an AD group that has read/write on a couple of DB's. They are able to connect to this SQL Instance. If i use their same machine, i am unable to connect to this SQL Instance. I can connect using other SQL Logins that DO NOT have sysadmin. If i use a SQL Login that DOES have sysadmin, i cannot connect. It seems like any login with sysadmin privileges is unable to connect??
L.Moy (55 rep)
Jun 9, 2025, 01:12 AM • Last activity: Jun 10, 2025, 01:53 AM
1 votes
2 answers
623 views
mySQL Workbench new Connection : There is no disk in drive. Please insert disk in \Device\Harddisk2\DR2
I'm trying to migrate the data at my company from Excel to mySQL so I'm very new at this. I just installed the latest mySQL package via the standard installer and when I try a new connection (I'm trying to get through the mySQLTutorial) the error pops up: MySQLWorkbench.exe - No disk There is no dis...
I'm trying to migrate the data at my company from Excel to mySQL so I'm very new at this. I just installed the latest mySQL package via the standard installer and when I try a new connection (I'm trying to get through the mySQLTutorial) the error pops up: MySQLWorkbench.exe - No disk There is no disk in drive. Please insert disk in drive \Device\Harddisk\DR2 My setup for the new connection is as follows: Connection name: local Connection method: Standard (TCP/IP) Hostname: 127.0.0.1 Port: 3306 Default schema: "" Anyone have any ideas? I'm completely at a loss here...
FranciscoRZ (11 rep)
Jan 29, 2019, 10:23 AM • Last activity: Jun 6, 2025, 11:03 PM
0 votes
1 answers
4267 views
SQLSTATE[HY000] [2002] Connection refused when trying to initiate connection via Dockerfile's CMD
I'm trying to run a Docker container based on: - PHP 8.1 - Apache 2.4 - MariaDB (latest official docker image) Dockerfile: ``` FROM php:8.1-apache WORKDIR /var/www/html/ RUN pecl install xdebug \ && apt update \ && apt install libzip-dev -y \ && docker-php-ext-enable xdebug \ && a2enmod rewrite \ &&...
I'm trying to run a Docker container based on: - PHP 8.1 - Apache 2.4 - MariaDB (latest official docker image) Dockerfile:
FROM php:8.1-apache

WORKDIR /var/www/html/

RUN pecl install xdebug \
    && apt update \
    && apt install libzip-dev -y \
    && docker-php-ext-enable xdebug \
    && a2enmod rewrite \
    && docker-php-ext-install zip \
    && rm -rf /var/lib/apt/lists/* \
    && docker-php-ext-install pdo pdo_mysql

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY composer.json .

RUN groupadd -r user && useradd -r -g user user
USER user
RUN composer install --no-dev

COPY . .

EXPOSE 80

CMD [ "sh", "-c", "php src/init.php" ]
docker-compose.yml:
services:

  php:
    build: ./php
    depends_on:
      - db
      - adminer
    container_name: php-apache
    ports:
      - 80:80
    volumes:
      # setup xdebug to be able to use PHP step debugger, if needed
      - ./php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
      - ./php/conf.d/error_reporting.ini:/usr/local/etc/php/conf.d/error_reporting.ini
      # apache config (server name)
      - ./apache/apache2.conf:/etc/apache2/apache2.conf
      # apache config (rewrite rule to reroute all requests to unknown resources through to REST controller)
      - ./apache/000-default.conf:/etc/apache2/sites-enabled/000-default.conf
      # Source code
      - ./php/src:/var/www/html/src
      # unbind local composer components
      - /php/vendor
      - /php/composer.lock
      - /php/composer.phar
    environment:
      MARIADB_HOST: db
      MARIADB_USER: root
      MARIADB_PASSWORD: top_very_secret
      MARIADB_DB: apidb

  adminer:
    image: adminer
    depends_on:
      - db
    restart: always
    ports:
      - 8080:8080

  db:
    image: mariadb
    container_name: db
    volumes:
      - maria-db-storage:/var/lib/mysql
    environment:
      MARIADB_ROOT_PASSWORD: top_very_secret
      MARIADB_DATABASE: apidb
    ports:
      - 3306:3306

volumes:
  maria-db-storage:
src/init.php connects with the DB and creates tables the application needs, if they do not already exist. To connect, I use the environment variables like so:
new PDO(
    "mysql:host={$_ENV['MARIADB_HOST']};dbname={$_ENV['MARIADB_DB']}",
    $_ENV['MARIADB_USER'],
    $_ENV['MARIADB_PASSWORD'],
    [
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
    ]
);
And for the first time I docker-compose up, I always get: SQLSTATE[HY000] Connection refused. At the top of the src/init.php script, I can successfully echo out all of the environment variables used in Docker. So they are all defined. I'm really confused with this, as docker-compose up and the DB connection only work after failing on the first time docker-compose up fails (with the above-mentioned error). When then calling docker-compose down, then do docker-compose up again in the subsequent times, things all work flawlessly. Any idea why this happens? I've been digging a little further, and I noticed that, wehn the mariadb image is built (e.g. when you first run docker-compose up with the above mentioned file contents), I get the above-mentioned error plus the output: PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER So it seems that, at the moment of the image being built; the MARIADB_ROOT_PASSWORD is for some reason not applied, but aftewards it is, and that that's the reason for the failed connection? Currently, I suppose that this is due to [this](https://hub.docker.com/_/mariadb) ?: > If there is no database initialized when the container starts, then a default database will be created. While this is the expected behavior, this means that it will not accept incoming connections until such initialization completes. This may cause issues when using automation tools, such as docker-compose, which start several containers simultaneously.
DevelJoe (163 rep)
Nov 16, 2022, 08:19 PM • Last activity: May 13, 2025, 05:00 AM
11 votes
1 answers
5809 views
PgAdmin 4 - How to connect to database using unix socket via ssh tunnel?
Even though it might sound related to [this question][1], it isn't, because I'm intreseted in the use of unix sockets instead of TCP/IP ones. However, I am unable to connect to a remote PostgreSQL database using unix sockets and an ssh tunnel with pgAdmin4. pgAdmin always claims a refused connection...
Even though it might sound related to this question , it isn't, because I'm intreseted in the use of unix sockets instead of TCP/IP ones. However, I am unable to connect to a remote PostgreSQL database using unix sockets and an ssh tunnel with pgAdmin4. pgAdmin always claims a refused connection by the server and asks for a password, which makes me wonder. When sshing into the server and using psql a connection can be made just flawlessly using the unix socket (/var/run/postgresql). Is there anything special that needs to be set to allow such a setup, or might this even be a bug in pgAdmin itself? I'd appreciate any ideas to solve this problem without having to resort on TCP/IP connections on the remote side. I also post some screens from my current config: connection tab ssh tunnel tab
Migsi (113 rep)
Nov 2, 2020, 01:19 PM • Last activity: May 4, 2025, 02:22 PM
0 votes
1 answers
406 views
connecting to an oracle sql database from sql developer on the same computer. When the computer is a domain computer
Hi I am trying to do DBA course that requires that I use Oracle database. I am using my corporate pc to do it. I set up the loopback adapter to enable localhost communication and setup the hosts file in system 32. When I start lsnrcrl However when I try to connect I get an error. 27-JUL-2016 08:59:0...
Hi I am trying to do DBA course that requires that I use Oracle database. I am using my corporate pc to do it. I set up the loopback adapter to enable localhost communication and setup the hosts file in system 32. When I start lsnrcrl However when I try to connect I get an error. 27-JUL-2016 08:59:00 * (CONNECT_DATA=(SID=xe)(CID=(PROGRAM=SQLDeveloper)(HOST=__jdbc__)(USER=ABC))) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=50619)) * establish * xe * 12505 Extra info 1. Listener.ora is set to localhost. 2. hostsfile in system32 is set to 192.168.1.1/domain name.ABCDEF1212221/ ABCDEF1212221 The lstnrctrl status is here. C:\Windows\system32> lsnrctl status LSNRCTL for 32-bit Windows: Version 11.2.0.2.0 - Production on 27-JUL-2016 13:19:16 Copyright (c) 1991, 2010, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for 32-bit Windows: Version 11.2.0.2.0 - Production Start Date 26-JUL-2016 15:30:00 Uptime 0 days 21 hr. 49 min. 16 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Default Service XE Listener Parameter File C:\oraclexe\app\oracle\product\11.2.0\server\network\admin\listener.ora Listener Log File C:\oraclexe\app\oracle\diag\tnslsnr\OLDKHQ133304\listener\alert\log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=abcdefg1212221.corporate.corporate.net)(PORT=1521))) Services Summary... Service "CLRExtProc" has 1 instance(s). Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully
DavyGravy (101 rep)
Jul 27, 2016, 07:24 AM • Last activity: Apr 15, 2025, 09:02 PM
2 votes
1 answers
65 views
How to count the number of connections to a postgres database?
The configuration file *postgresql.conf* contains a setting for `max_connections`. I have a number of related questions... 1. In the context of this value, what exactly constitutes a 'connection'? 2. What's the best way to calculate it? 3. What are the symptoms/error messages that might be expected...
The configuration file *postgresql.conf* contains a setting for max_connections. I have a number of related questions... 1. In the context of this value, what exactly constitutes a 'connection'? 2. What's the best way to calculate it? 3. What are the symptoms/error messages that might be expected on a database that needs to have max_connections increased? I've seen several posting on how to count the number of current connections... 1) SELECT count(*) from pg_stat_activity; 2) SELECT count(distinct(numbackends)) FROM pg_stat_database; 3) SELECT sum(numbackends) FROM pg_stat_database WHERE datname is not null; 4) SELECT count(*) FROM pg_stat_activity WHERE datname is not null; 5) select sum(numbackends) from pg_stat_database; They often produce different results, and take varying times to execute. Which query should give the most accurate results, and how can I tell if I need to increase max_connections?
ConanTheGerbil (1303 rep)
Apr 10, 2025, 06:14 PM • Last activity: Apr 11, 2025, 06:11 AM
0 votes
1 answers
57 views
Mysql "ERROR 1045 (28000): Access denied" only when host is specified
I'm scratching my head with this issue. I have an Azure flexible for MySQL server with MySQL 5.7. I've created and give grants for a new user with the "%" wildcard, following the syntax (don't worry, I'm using fake names for everything): ``` MySQL [(none)]> CREATE USER 'mynewuser'@'%' IDENTIFIED BY...
I'm scratching my head with this issue. I have an Azure flexible for MySQL server with MySQL 5.7. I've created and give grants for a new user with the "%" wildcard, following the syntax (don't worry, I'm using fake names for everything):
MySQL [(none)]> CREATE USER 'mynewuser'@'%' IDENTIFIED BY 'password';
MySQL [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'mynewuser'@'%';
MySQL [(none)]> FLUSH PRIVILEGES;

MySQL [(none)]> select user, host, account_locked from mysql.user where user = 'mynewuser'
    -> ;
+--------------+------+----------------+
| user         | host | account_locked |
+--------------+------+----------------+
| mynewuser    | %    | N              |
+--------------+------+----------------+
1 row in set (0.01 sec)

MySQL [(none)]> show grants for mynewuser
    -> ;
+------------------------------------------------------------+
| Grants for mynewuser@%                                     |
+------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'mynewuser'@'%'                      |
| GRANT ALL PRIVILEGES ON *.* TO 'mynewuser'@'%'             |
+------------------------------------------------------------+
But when I try a connection from a remote machine, if I try to specify the host (even localhost), I've got an Access Denied error from 172.26.3.34 (The remote machine, JUMPSRV01 ip):
JUMPSRV01> mysql -hSRVDB01.mysql.database.azure.com --ssl=true -umynewuser@SRVDB01 -p 
Enter password: 
ERROR 1045 (28000): Access denied for user 'mynewuser@localhost'@'172.26.3.34' (using password: YES)

JUMPSRV01> mysql -hSRVDB01.mysql.database.azure.com --ssl=true -umynewuser@localhost -p 
Enter password: 
ERROR 1045 (28000): Access denied for user 'mynewuser@localhost'@'172.26.3.34' (using password: YES)

JUMPSRV01> mysql -hSRVDB01.mysql.database.azure.com --ssl=true -umynewuser@JUMPSRV01 -p 
Enter password: 
ERROR 1045 (28000): Access denied for user 'mynewuser@localhost'@'172.26.3.34' (using password: YES)
**However**, if I don't specify the host in the username parameter, it works
JUMPSRV01> mysql -hSRVDB01.mysql.database.azure.com --ssl=true -umynewuser -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 117
Server version: 5.7.44-azure-log MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]>
What am I missing? The problem i am facing is that I'm replicating a database, and all the services and clients connects using the "username@dbhost" syntax and I don't know how many host or services are trying to connect to the database like that, so modify the clients and services connection string is no possible.
vegatripy (668 rep)
Mar 25, 2025, 12:11 PM • Last activity: Mar 26, 2025, 08:47 AM
0 votes
3 answers
224 views
Force Strict Encryption from a C++ Application
I am using SQL Server 2022 Standard Edition. It has an additional option of setting *Force Strict Encryption*, which I have set on the server side. Using SSMS on a client machine, I am able to connect and access a user table. But I am failing to do the same from a C++ application. Below is the sampl...
I am using SQL Server 2022 Standard Edition. It has an additional option of setting *Force Strict Encryption*, which I have set on the server side. Using SSMS on a client machine, I am able to connect and access a user table. But I am failing to do the same from a C++ application. Below is the sample code I am trying:
-cpp
auto pDatabase = new CDatabase();
CString connString = L"DRIVER={ODBC Driver 18 for SQL Server};Network=DBMSSOCN;DATABASE=TESTTDE;Encrypt=strict;TrustServerCertificate=no;HostNameInCertificate=10.100.200.300;Mars_Connection=yes;SERVER=10.100.200.300\\TDE,2144;UID=Supervisor;PWD=password;";
auto reply = pDatabase->OpenEx(connString, CDatabase::noOdbcDialog);
CStringArray userNameList;
CString strUserName;
CStringW strUserNameW;
CString SQLString = L"select * from TESTTDE.dbo.UserTable;";
CRecordset userRecords(pDatabase);
userRecords.Open(CRecordset::forwardOnly, SQLString, CRecordset::readOnly);
while (!userRecords.IsEOF())
{
	userRecords.GetFieldValue(L"Name", strUserNameW);
	strUserName = CW2A(strUserNameW.Trim());
	userNameList.Add(strUserName.Trim());
	userRecords.MoveNext();
}
userRecords.Close();
userRecords.Open generates an exception and I am unable to access the database. Can someone shed some light on this? What could I try to make this work? --- I am using a self-signed certificate. It works if I use *Force Encryption* without enabling *Force Strict Encryption* at the server. Exception at client side:
-none
The incoming tabular data stream (TDS) protocol stream is incorrect.
The stream ended unexpectedly.
State:28000,Native:4002,
Origin:[Microsoft][ODBC Driver 18 for SQL Server][SQL Server]
Server log:
-none
The SQL Server or the endpoint is configured to accept only 
strict (TDS 8.0 and above) connections.
The connection has been closed.
Is there anything that prevents self-signed certificate usage with *strict* encryption? --- Some additional observations: Using low-level SQL APIs from a sample application I was able to fetch data from the server even when Force Strict Encryption was enabled. The code is below:
-cpp
SQLHANDLE env;
SQLHANDLE dbc;
SQLHANDLE stmt;
SQLRETURN ret;

SQLWCHAR* connStr = (SQLWCHAR*)L"Driver={ODBC Driver 18 for SQL Server};Server=10.100.200.300\\TDE;Database=TESTTDE;Uid=Supervisor;Pwd=password;Encrypt=strict;";

// Allocate environment handle
ret = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
if (ret == SQL_ERROR) {
	std::wcerr << L"Error allocating environment handle." << std::endl;
	return;
}

// Set the ODBC version environment attribute
ret = SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
if (ret == SQL_ERROR) {
	checkDiagnostic(env, SQL_HANDLE_ENV);
	SQLFreeHandle(SQL_HANDLE_ENV, env);
	return;
}

// Allocate connection handle
ret = SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc);
if (ret == SQL_ERROR) {
	checkDiagnostic(env, SQL_HANDLE_ENV);
	SQLFreeHandle(SQL_HANDLE_ENV, env);
	return;
}

// Connect to the data source
ret = SQLDriverConnectW(dbc, NULL, connStr, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_COMPLETE);
if (ret == SQL_ERROR) {
	checkDiagnostic(dbc, SQL_HANDLE_DBC);
	SQLFreeHandle(SQL_HANDLE_DBC, dbc);
	SQLFreeHandle(SQL_HANDLE_ENV, env);
	return;
}

// Allocate statement handle
ret = SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt);
if (ret == SQL_ERROR) {
	checkDiagnostic(dbc, SQL_HANDLE_DBC);
	SQLDisconnect(dbc);
	SQLFreeHandle(SQL_HANDLE_DBC, dbc);
	SQLFreeHandle(SQL_HANDLE_ENV, env);
	return;
}

// Execute a query
SQLWCHAR* query = (SQLWCHAR*)L"SELECT * FROM UserTable";
ret = SQLExecDirectW(stmt, query, SQL_NTS);
if (ret == SQL_ERROR) {
	checkDiagnostic(stmt, SQL_HANDLE_STMT);
}
else
{
	SQLWCHAR name;
	while (SQLFetch(stmt) == SQL_SUCCESS) {
		ret = SQLGetData(stmt, 1, SQL_C_WCHAR, name, sizeof(name), NULL);
		if (SQL_SUCCEEDED(ret)) {
			AfxMessageBox((LPCTSTR)name);
		}
	}
}

// Clean up
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
SQLDisconnect(dbc);
SQLFreeHandle(SQL_HANDLE_DBC, dbc);
SQLFreeHandle(SQL_HANDLE_ENV, env);
I suspect that MFC class API CRecordset::Open() has some issue in supporting TDS 8.0.
Amal Jesudas (69 rep)
Feb 26, 2025, 11:56 AM • Last activity: Mar 5, 2025, 07:25 AM
1 votes
2 answers
3118 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
17 votes
4 answers
97014 views
The specified network name is no longer available
We have an application that access the database (Sql server 2014 enterprise edition). The application calls a stored procedures to access the database. Everything was working fine until recently start sending the following error and stop the applications. Restarting the app fix the issue temporarily...
We have an application that access the database (Sql server 2014 enterprise edition). The application calls a stored procedures to access the database. Everything was working fine until recently start sending the following error and stop the applications. Restarting the app fix the issue temporarily but facing the same error latter. >Error: A transport-level error has occurred when receiving results from the server. (Provider: TCP Provider, error: 0 - The specified network name is no longer available.) I did a lot of research which most of them pointing out as a network issue but could not find anything to actually solve the problem. Do anyone know what change I should have to make on the database side to resolve this issue. I highly appreciate any suggestions.
Hailegziabher Dechassa (856 rep)
Sep 13, 2016, 02:20 PM • Last activity: Feb 16, 2025, 02:59 AM
1 votes
2 answers
2673 views
SQL Server connectivity without specifying tcp/port
Having connection issues out of nowhere in my lab (Azure VMs): SQL 2016, sp1, cu4 all the way around, Windows 2016 Datacenter Windows Failover cluster for SQL AG testing. **SQLServer-0:** Default instance (port `1431`) `Inst1` (port `1499`) **SQLServer-1:** Default instance (port `1431`) `Inst1` (po...
Having connection issues out of nowhere in my lab (Azure VMs): SQL 2016, sp1, cu4 all the way around, Windows 2016 Datacenter Windows Failover cluster for SQL AG testing. **SQLServer-0:** Default instance (port 1431) Inst1 (port 1499) **SQLServer-1:** Default instance (port 1431) Inst1 (port 1499) From SQLServer-0, I can only connect to the remote instance(s) using tcp:SQLServer-1, 1431 (or tcp:SQlServer-1.kevinsdomain.com,1431). Same thing for the named instance. Same thing from SQLServer-1 to SQLServer-0. Ping of just the NetBIOS name works just fine, ping -a resolves the FQDN. None of these are running on port 1433, both servers are running SQL Browser under NT Authority\Local Service. This is my test domain, along with a domain controller, DNS, etc. Windows firewall on each has all of the ports open that are needed, including UDP 1434. I'm sure there's something simple I've forgotten to check, flush, whatever. Just can't think of it. enter image description here
Kevin3NF (1221 rep)
Mar 28, 2018, 09:56 PM • Last activity: Feb 14, 2025, 07:03 PM
2 votes
1 answers
2058 views
Flush Host Connection Blocked, but some connections allowed
We are running Percona MySQL 5.6.30. We've had an issue where a PHP script on a different host was reporting an issue connecting to the database: >Database may be down : SQLSTATE[HY000] [1129] Host 'x.x.x.101' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'" We di...
We are running Percona MySQL 5.6.30. We've had an issue where a PHP script on a different host was reporting an issue connecting to the database: >Database may be down : SQLSTATE[HY000] Host 'x.x.x.101' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'" We did the flush hosts, and it resolved the issue. When we went back to check the Percona Audit Logs for the same time, we see a number of connections at that same time, from that same host ('x.x.x.101'). I'm trying to understand how a host could be blocked, and not blocked, at the same time. :) Any ideas?
Michael Dugas (21 rep)
Aug 12, 2016, 07:00 PM • Last activity: Feb 6, 2025, 07:02 AM
1 votes
2 answers
463 views
Can't connect to named instance from remote server
I have researched a lot on this issue but can't seem to find a solution for it. I have a named instance created on a server but I can't connect using the Servername\InstanceName. I am using SQL Server 2016 Enterprise Edition. Here is the setup: Servername: QA1 Has default instanced installed and als...
I have researched a lot on this issue but can't seem to find a solution for it. I have a named instance created on a server but I can't connect using the Servername\InstanceName. I am using SQL Server 2016 Enterprise Edition. Here is the setup: Servername: QA1 Has default instanced installed and also named instance: BUInt0 The SQL Browser service is started and I checked and UDP 1434 is allowed. When I tried to connect from a remote server, I cannot reach it using QA1\BUInt0. I get the following error: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (.Net SqlClient Data Provider) But it works if it use IPAddress\BUInt0. I had my system engineers check DNS but they don't see any issues. Anyone have any ideas what is going on and why I can't connect using Servername\NamedInstance format?
kaitlyn (593 rep)
Nov 30, 2023, 07:34 PM • Last activity: Feb 1, 2025, 03:03 AM
Showing page 1 of 20 total questions