DISQUS

Tech-Recipes: Create a MySQL user account | MySQL | Tech-Recipes

  • Anonymous · 5 years ago
    Don't forget to "flush privileges" afterwards.
  • Warlock · 5 years ago
    grant all on accounts.* to jsmith@localhost identified by 'Secret15';

    This only work's for the localhost how do i create an account that can be accesd by any ip and not from the same pc of the server ???? 8O
  • qmchenry · 5 years ago
    You can specify the hostname or IP address that is allowed access in place of localhost in this command. So, if you want to be able to connect from a host named 'workstation' (10.100.15.2), use one of these:

    grant all on accounts.* to jsmith@workstation identified by 'Secret15';
    grant all on accounts.* to jsmith@10.100.15.2 identified by 'Secret15';

    A dubious alternative, one with serious security consequences (you've been warned) is to allow access to jsmith from anywhere:

    grant all on accounts.* to jsmith@% identified by 'Secret15';

    In this context, the % symbol is a wildcard permitting access from any host. An important note - from my experience, it is necessary to create the localhost access control in addition to a specific host or global access control. If you do not, connections from localhost may not function properly.
  • Anonymous · 5 years ago
    <ul id="quote"><h6>Anonymous wrote:</h6>Don't forget to "flush privileges" afterwards.</ul>

    I read that flushing privileges is only neccessary if you use insert instead of grant:

    "The reason for using FLUSH PRIVILEGES when you create accounts with INSERT is to tell the server to re-read the grant tables. Otherwise, the changes will go unnoticed until you restart the server. With GRANT, FLUSH PRIVILEGES is unnecessary."

    Quote from http://dev.mysql.com/doc/mysql/en/Adding_users.html
  • upender · 5 years ago
    <ul id="quote"><h6>Anonymous wrote:</h6>Don't forget to "flush privileges" afterwards.</ul>
  • Anonymous · 4 years ago
    <ul id="quote"><h6>Anonymous wrote:</h6></ul><ul id="quote"><h6>Anonymous wrote:</h6>Don't forget to "flush privileges" afterwards.</ul>

    I read that flushing privileges is only neccessary if you use insert instead of grant:

    "The reason for using FLUSH PRIVILEGES when you create accounts with INSERT is to tell the server to re-read the grant tables. Otherwise, the changes will go unnoticed until you restart the server. With GRANT, FLUSH PRIVILEGES is unnecessary."

    Quote from http://dev.mysql.com/doc/mysql/en/Adding_users.html
  • Kenny Vadas · 4 years ago
    This is very nice.. and good... Kenny Vadas
  • Anonymous · 4 years ago
    <ul id="quote"><h6>Kenny Vadas wrote:</h6>This is very nice.. and good... Kenny Vadas</ul>
  • Murali · 12 months ago
    Hi friend. thank u very much. your sample code working good.
  • ayush · 3 months ago
    i want to join with this