1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Change default hostname for new mysql users

Discussion in 'Plesk 9.x for Linux Issues, Fixes, How-To' started by Thomas Spalinger, Feb 1, 2010.

  1. Thomas Spalinger

    Thomas Spalinger New Pleskian

    19
    35%
    Joined:
    Jan 27, 2010
    Messages:
    5
    Likes Received:
    0
    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?
     
  2. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,564
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    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.
     
  3. Thomas Spalinger

    Thomas Spalinger New Pleskian

    19
    35%
    Joined:
    Jan 27, 2010
    Messages:
    5
    Likes Received:
    0
    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.
     
Loading...