Файловый сервер Linux с доступом для всех
**Step 1: Create the Linux User** - Create a new user on the Linux system using the `adduser` or `useradd` command: ```bash sudo adduser admin_user ``` Replace "admin_user" with the desired username for the admin user. **Step 2: Assign Database Access** - For each database, you'll need to grant the admin user appropriate privileges. Here's a high-level overview for three common databases: **MySQL/MariaDB:** - Access the MySQL shell as a privileged user: ```bash sudo mysql ``` - Create a new user and grant privileges: ```sql CREATE USER 'admin_user'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON database1.* TO 'admin_user'@'localhost'; GRANT ALL PRIVILEGES ON database2.* TO 'admin_user'@'localhost'; GRANT ALL PRIVILEGES ON database3.* TO 'admin_user'@'localhost'; FLUSH PRIVILEGES; ``` **PostgreSQL:** - Access the PostgreSQL prompt as a privileged user: ```bash sudo -u postgres psql ``` - Create a new user and grant privileges: ```sql CREATE USER admin_user WITH PASSWORD 'password'; GRANT ALL PRIVILEGES ON DATABASE database1 TO admin_user; GRANT ALL PRIVILEGES ON DATABASE database2 TO admin_user; GRANT ALL PRIVILEGES ON DATABASE database3 TO admin_user; ``` **MongoDB:** - Access the MongoDB shell: ```bash mongo ``` - Switch to the admin database and create a user with appropriate privileges: ```javascript use admin db.createUser( { user: "admin_user", pwd: "password", roles: [ { role: "readWrite", db: "database1" }, { role: "readWrite", db: "database2" }, { role: "readWrite", db: "database3" } ] } ) ``` **Step 3: Test Database Access** - After setting up the database access, you can test the admin user's access to the databases using the respective database clients or command-line tools. By following these steps, you can create an admin user on a Linux system with access to three different databases. Be sure to replace "admin_user" and "password" with your desired username and password, and adjust the database names and privileges to match your specific environment.
Установка PostreSQL и создание базы на Linux
Подготовка к установке Обновляем систему командой: yum -y update && yum -y upgrade Установка yum -y install postgresql14-server Инициализация postgresql-14-setup initdb Запускаем службу и добавляем ее в автозагрузку, командой: systemctl enable --now postgresql-14 Заходим под пользователем PostgreSQL: su - postgres Подключаемся к базе: psql Затем создаём пользователя (user) и базу данных (db) и предоставляем...