MySQL Basic Operations for User Account Management
Install MySQL server (not MySQL package)
1
yum -y install mysql-server
Start and launch MySQL
1
2
3service mysqld start
mysql -uroot -p
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
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(“*”)
Update password.
1
ALTER USER 'user_name'@'host' IDENTIFIED BY 'password';
Delete users.
1
DROP USER 'user_name'@'host';