MySQL Basic Operations for User Account Management

mysql

  1. Install MySQL server (not MySQL package)

    1
    yum -y install mysql-server
  2. Start and launch MySQL

    1
    2
    3
    service mysqld start

    mysql -uroot -p
  1. Add users.

    1
    CREATE USER 'user_name'@'host' IDENTIFIED BY 'password';

    The value of host:

    • %: connect to mysql server from any other machine
    • localhost: just local host
    • ip_address: specific ip address
  2. Grant authority to users.

    1
    GRANT ALL PRIVILEGES on [db_name].[db_table_name] TO [mysql_user_name]@[the_value_of_host] IDENTIFIED BY '[mysql_user_password]';

    [all privileges] can be set with specific authority(“select,delete,update,create,drop”)

    [db_name] can be set with all databases(“*”)

    [db_table_name] can be set with all tables(“*”)

  3. Update password.

    1
    ALTER USER 'user_name'@'host' IDENTIFIED BY 'password';
  4. Delete users.

    1
    DROP USER 'user_name'@'host';