diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index f62dd5471eb..2bdbed31592 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -56,6 +56,9 @@
 #include "password.h"
 
 #include "sql_plugin_compat.h"
+#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
+#include "../storage/perfschema/pfs_server.h"
+#endif
 
 bool mysql_user_table_is_in_short_password_format= false;
 
@@ -12214,6 +12217,13 @@ static bool send_server_handshake_packet(MPVIO_EXT *mpvio,
 
   thd->client_capabilities|= CAN_CLIENT_COMPRESS;
 
+#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
+  if (!pfs_param.m_enabled)
+    thd->client_capabilities&= ~CLIENT_CONNECT_ATTRS;
+#else
+  thd->client_capabilities&= ~CLIENT_CONNECT_ATTRS;
+#endif
+
   if (ssl_acceptor_fd)
   {
     thd->client_capabilities |= CLIENT_SSL;
