Title: Cannot retrieve user rules from database
Last modified: August 30, 2016

---

# Cannot retrieve user rules from database

 *  Resolved [gagomap](https://wordpress.org/support/users/gagomap/)
 * (@gagomap)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/)
 * Hello,
 * I have changed admin user email, and received a notice: “Cannot retrieve user
   rules from database”
 * What does it mean ?
    I have logout and login again, and i don’t see this notice
   again.
 * How can i change admin user email and don’t get this notice ?
 * [https://wordpress.org/plugins/ninjafirewall/](https://wordpress.org/plugins/ninjafirewall/)

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/page/2/?output_format=md)

 *  Thread Starter [gagomap](https://wordpress.org/support/users/gagomap/)
 * (@gagomap)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834222)
 * I just have deactivated NF and changed admin email. Then i have reactivated NF
   again and didn’t see any noctice.
 * NF iss very strange.
 *  Plugin Author [nintechnet](https://wordpress.org/support/users/nintechnet/)
 * (@nintechnet)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834226)
 * Hi,
 * Where did you change the admin email: From the WordPress “Users” menu, or the“
   Settings” Menu or from NinjaFirewall “Event Notifications” menu?
 *  Thread Starter [gagomap](https://wordpress.org/support/users/gagomap/)
 * (@gagomap)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834227)
 * it’s in admin profile.
 *  Plugin Author [nintechnet](https://wordpress.org/support/users/nintechnet/)
 * (@nintechnet)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834232)
 * Maybe you (or your host) had a database backup running and the tables were locked
   which would explain the message? Or your DB was too slow and it was not possible
   to connect to it?
 * I can change the admin password and I don’t get any error.
 *  Thread Starter [gagomap](https://wordpress.org/support/users/gagomap/)
 * (@gagomap)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834233)
 * No, there is no backup running or my DB is too slow.
    I run 2 site on a VPS 2GB
   ram. Everthing are very fast.
 * I have tried to change email 3 times. This notice always display.
 *  Plugin Author [nintechnet](https://wordpress.org/support/users/nintechnet/)
 * (@nintechnet)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834234)
 * Did you check MySQL log?
    The firewall will display the error message if this
   query failed:
 *     ```
       SELECT * FROM '{table_prefix}options' WHERE 'option_name' = 'nfw_rules'
       ```
   
 *  Thread Starter [gagomap](https://wordpress.org/support/users/gagomap/)
 * (@gagomap)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834236)
 * Where i can find MySQL log file ?
 * I’m using MariaDB on EasyEngine.
 *  Plugin Author [nintechnet](https://wordpress.org/support/users/nintechnet/)
 * (@nintechnet)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834239)
 * Depends on your OS, distro etc.
    Folders: /var/log/ and /var/log/mysql/ /var/
   lib/mysql/
 * Files: /var/log/messages
 *  Thread Starter [gagomap](https://wordpress.org/support/users/gagomap/)
 * (@gagomap)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834250)
 * I’m installing all site on Ubuntu. I had install suhoshin on my VPS.
 * There is no error message in log file.
    I have checked /var/log/mysql and all
   log files in /var/log
 *  Plugin Author [nintechnet](https://wordpress.org/support/users/nintechnet/)
 * (@nintechnet)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834297)
 * We can force NinjaFirewall to write the error message to the dashboard.
    But 
   fist, I need to know which message exactly you received because there are 3 differents
   ones. Is it: Cannot retrieve user rules from database (#1) Or: Cannot retrieve
   user rules from database (#2) Or: Cannot retrieve user rules from database (#
   3)
 *  Thread Starter [gagomap](https://wordpress.org/support/users/gagomap/)
 * (@gagomap)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834302)
 * It is: Cannot retrieve user rules from database (#2)
 * As i remember it. 😀
 *  Plugin Author [nintechnet](https://wordpress.org/support/users/nintechnet/)
 * (@nintechnet)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834309)
 * You can try this:
 * 1. Download the /plugins/ninjafirewall/lib/firewall.php to your computer.
    2.
   Make a backup of it (very important). 3. Open firewall.php and search for those
   2 lines: –[Line 325](https://plugins.trac.wordpress.org/browser/ninjafirewall/tags/1.8.3/lib/firewall.php#L325):
 *     ```
       define( 'NFW_STATUS', 7 );
       ```
   
 * –[Line 331](https://plugins.trac.wordpress.org/browser/ninjafirewall/tags/1.8.3/lib/firewall.php#L331):
 *     ```
       define( 'NFW_STATUS', 8 );
       ```
   
 * -Replace those 2 lines with that one:
 *     ```
       define( 'NFW_STATUS', htmlspecialchars($nfw_['mysqli']->error) );
       ```
   
 * 4. Save and upload the new version.
    5. Go to your admin dashboard and paste 
   here the error message. 6. Restore the original firewall.php backup script.
 *  Thread Starter [gagomap](https://wordpress.org/support/users/gagomap/)
 * (@gagomap)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834311)
 * I do as you say, but there is no error message, and there is no notice appear.
 * I will restore my VPS then i can test more.
 *  Thread Starter [gagomap](https://wordpress.org/support/users/gagomap/)
 * (@gagomap)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834317)
 * After i restored my VPS, replaced your code, changed email again.
    And this is
   a error message:
 * > NinjaFirewall fatal error: unknown error #MySQL server has gone away. Review
   > your installation, your site is not protected
 * .
 *  Plugin Author [nintechnet](https://wordpress.org/support/users/nintechnet/)
 * (@nintechnet)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/#post-6834319)
 * That is a MySQL error/issue.
    You will need to check the doc ([http://dev.mysql.com/doc/refman/5.7/en/gone-away.html](http://dev.mysql.com/doc/refman/5.7/en/gone-away.html))
   and solve the problem. Check time out values, connection etc.

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/page/2/?output_format=md)

The topic ‘Cannot retrieve user rules from database’ is closed to new replies.

 * ![](https://ps.w.org/ninjafirewall/assets/icon-256x256.png?rev=976137)
 * [NinjaFirewall (WP Edition) - Advanced Security Plugin and Firewall](https://wordpress.org/plugins/ninjafirewall/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ninjafirewall/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ninjafirewall/)
 * [Active Topics](https://wordpress.org/support/plugin/ninjafirewall/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ninjafirewall/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ninjafirewall/reviews/)

 * 21 replies
 * 3 participants
 * Last reply from: [jugadelpi](https://wordpress.org/support/users/jugadelpi/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/cannot-retrieve-user-rules-from-database/page/2/#post-8380048)
 * Status: resolved