• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Change default hostname for new mysql users

Thomas Spalinger

New Pleskian
Where can i change the default host for new mysql users.
I thought plesk user localhost as default... but for some reason on my installation '%' is the default. Is there a simple way to change the default for new created users?
 
As I know '%' for Host is hardcoded and can't be changed. '%' means access from any host.
I can recommend you use Event manager with 'Database user account created' Event with some script for changing '%' to 'localhost' in mysql.user table after creating new DB user.
 
Thanks.

For others that have the same "problem", I created a bash script called in the event (runned as pmaadm, but could be any other user that can run mysql) and in the script there is the following command:
/usr/bin/mysql --user=admin --password="`cat /etc/psa/.psa.shadow`" --database=mysql --execute="update user set host='localhost' where user='${NEW_DATABASE_USER_NAME}'; update db set host='localhost' where user='${NEW_DATABASE_USER_NAME}'; FLUSH PRIVILEGES;"

this works for local mysql server only.
 
Back
Top