This GRANT command string works like this:

  • GRANT ALL PRIVILEGES

    GRANT ALL PRIVILEGES ON *.* TO mary@localhost IDENTIFIED BY 'ship3marker';

    The GRANT command is used to grant privileges on a database (or table) to users. In this case, you're granting all add/delete/modify privileges for the user mary.

  • ON *.*

    GRANT ALL PRIVILEGES ON *.* TO mary@localhost IDENTIFIED BY 'ship3marker';

    The ON command restricts the combination of databases and tables the user will have access to. Here, you're granting privileges on any (*) table in every (*) database.

    If you wanted to grant rights to a specific database, you'd use something like:

    GRANT ALL PRIVILEGES ON us_presidents.*

    To restrict access to only the name table in the us_presidents database, you'd use:

    GRANT ALL PRIVILEGES ON us_presidents.name

  • TO mary@localhost

    GRANT ALL PRIVILEGES ON *.* TO mary@localhost IDENTIFIED BY 'ship3marker';

    TO specifies the account you are granting privileges to: a user named mary who can connect to localhost.

  • IDENTIFIED BY 'ship3marker'

    GRANT ALL PRIVILEGES ON *.* TO mary@localhost IDENTIFIED BY 'ship3marker';

    This string sets the password for the user mary.