{"id":11068,"date":"2026-06-03T13:33:52","date_gmt":"2026-06-03T13:33:52","guid":{"rendered":"https:\/\/www.hostinger.com\/support\/?p=11068"},"modified":"2026-06-03T13:58:34","modified_gmt":"2026-06-03T13:58:34","slug":"how-to-fix-mysql-operation-not-permitted-error","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/how-to-fix-mysql-operation-not-permitted-error\/","title":{"rendered":"How to fix MySQL &#8220;Operation not permitted&#8221; error"},"content":{"rendered":"<p>If your website is showing a database connection error such as:<\/p><ul>\n<li>PHP Fatal error: Uncaught mysqli_sql_exception: Operation not permitted<\/li>\n<li>Connection failed: Operation not permitted<\/li>\n<li>ERROR: Could not connect. Operation not permitted<\/li>\n<li>SQLSTATE[HY000] [2002] Operation not permitted<\/li>\n<\/ul><p>This means your website is likely opening a new MySQL connection on every page request, instead of reusing an existing one. Hostinger enforces a per-account MySQL connection rate limit (10 new connections per second) to ensure fair resource usage across all customers. Websites that open a fresh connection on every request can exceed this limit during traffic bursts, causing the error above.<\/p><p>To resolve the issue, you just need to switch to persistent MySQL connections.<\/p><h2 id=\"h-before-you-start\">Before you start<\/h2><ul>\n<li>You will need access to your website&rsquo;s PHP files via hPanel File Manager or FTP. Check how to <a href=\"https:\/\/www.hostinger.com\/support\/4548688-basic-actions-in-the-file-manager-in-hostinger\/#h-try-the-hostinger-file-manager\">here<\/a><\/li>\n<li>This issue currently affects websites hosted on Hostinger&rsquo;s India servers.<\/li>\n<li>The fix applies to websites using PHP with either <strong>mysqli<\/strong> or <strong>PDO<\/strong> to connect to MySQL.<\/li>\n<\/ul><h2 id=\"h-how-to-fix-it\">How to fix it<\/h2><p>You need to locate the file in your website&rsquo;s code that handles the database connection. This is typically named &ldquo;config.php&rdquo;, &ldquo;db.php&rdquo;, &ldquo;connect.php&rdquo;, &ldquo;database.php&rdquo;, or similar.<\/p><h3>Option 1 &ndash; If your site uses mysqli<\/h3><p>Find the line that looks like this:<\/p><pre class=\"p1\">mysqli_connect(\"localhost\", $user, $pass, $db);<\/pre><p>Change &ldquo;localhost&rdquo; to &ldquo;p:localhost&rdquo;:<\/p><pre class=\"p1\">mysqli_connect(\"<strong>p:<\/strong>localhost\", $user, $pass, $db);<\/pre><p>The &ldquo;p:&rdquo; prefix tells PHP to use a persistent connection, keeping it open across requests instead of creating a new one each time.<\/p><h3>Option 2 &ndash; If your site uses PDO<\/h3><p>Find the line that looks like this:<\/p><pre class=\"p1\">new PDO(\"mysql:host=localhost;dbname=$db\", $user, $pass);<\/pre><p>Add &ldquo;[PDO::ATTR_PERSISTENT =&gt; true]&rdquo; as a fourth argument:<\/p><pre class=\"p1\">new PDO(\"mysql:host=localhost;dbname=$db\", $user, $pass, <strong>[PDO::ATTR_PERSISTENT =&gt; true]<\/strong>);<\/pre><p>Save the file and reload your website.<\/p><h3>Conclusion<\/h3><p>After making this change, your website will reuse the existing MySQL connection instead of opening a new one on every request. This keeps your connection count within Hostinger&rsquo;s rate limits and resolves the &ldquo;Operation not permitted&rdquo; error. Your database credentials and all other settings remain unchanged.<\/p><p>&nbsp;<\/p><div class=\"intercom-interblocks-callout\" style=\"background-color: #e3e7fa80;border-color: #334bfa33\">\n<p><strong>Notes:<\/strong><\/p>\n<ul>\n<li>This fix does not require any changes to your database credentials or database name.<\/li>\n<li>If you are using a CMS such as WordPress, Joomla, or a framework with its own database abstraction layer, the connection file location may differ. Check your CMS documentation for how to enable persistent database connections.<\/li>\n<li>If the error persists after applying the fix, contact Hostinger support for further assistance.<\/li>\n<\/ul>\n<\/div><p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If your website is showing a database connection error such as: PHP Fatal error: Uncaught mysqli_sql_exception: Operation not permitted Connection failed: Operation not permitted ERROR:&#8230;<\/p>\n","protected":false},"author":599,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[160],"tags":[],"class_list":["post-11068","post","type-post","status-publish","format-standard","hentry","category-mysql-databases"],"hreflangs":[],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/11068","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/599"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=11068"}],"version-history":[{"count":10,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/11068\/revisions"}],"predecessor-version":[{"id":11078,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/11068\/revisions\/11078"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=11068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=11068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=11068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}