(1) PostgreSQL:
创建用户 xxxx1,密码 xxxx,创建数据库 xxxx2,赋予 xxxx1 在 xxxx2 上的所有权限。
# sudo -s -u postgres
$ psql
postgres# CREATE USER xxxx1 WITH PASSWORD 'xxxx';
postgres# CREATE DATABASE xxxx2;
postgres# GRANT ALL PRIVILEGES ON DATABASE xxxx2 to xxxx1;
$ psql
postgres# CREATE USER xxxx1 WITH PASSWORD 'xxxx';
postgres# CREATE DATABASE xxxx2;
postgres# GRANT ALL PRIVILEGES ON DATABASE xxxx2 to xxxx1;
(2) MySQL
创建用户 xxxx1,密码 xxxx,创建数据库 xxxx2,赋予 xxxx1 在 xxxx2 上的所有权限。
# cd /usr/local/mysql/bin # ./mysql -u root -h localhost -p mysql> CREATE USER xxxx1@'localhost' IDENTIFIED BY 'xxxx'; mysql> CREATE DATABASE xxxx2; mysql> GRANT ALL PRIVILEGES ON xxxx2.* TO xxxx1@'localhost'
(3) MySQL 的启动和关闭
# cd /usr/local/mysql # bin/mysqld_safe --user=mysql & # bin/mysqladmin -u root -h localhost -p shutdown