Removal of access hosts clearing from mysql.user for shared user

Version 1.59

Bugfix
Finished

If you had a shared User spanning multiple databases, then removing an access that was on both databases ended up clearing the user@1.2.3.4 from mysql.user, preventing user@1.2.3.4 from being used on the other DB. The old method was simply clearing all instances from mysql.user and mysql.db, which was not using the new REVOKE/DROP USER methods anyway. This change makes use of the mysql_use_new_user_methods option (including mysql_detect_correct_methods=1), and will instead: 1) Revoke user_dbuser@1.2.3.4 from user_dbname.* 2) If user_dbuser@1.2.3.4 exists on no other database in mysql.db, DROP USER from mysql.user. This fix also affects the system account, which is shared over all DBs, and was incorrectly being cleared from all DBs for that given access host, when the host was only removed from one DB. This also changes the logic for older MySQL/MariaDB versions not using the new method (using mysql_use_new_user_methods=0, or mysql_detect_correct_methods=1 detects old version)

Interested to try DirectAdmin? Get a 30-day Free Trial!