34 lines
776 B
Bash
Executable File
34 lines
776 B
Bash
Executable File
#!/bin/bash
|
|
|
|
|
|
# ask type of instalation: 1- server / 2- client
|
|
|
|
sudo apt update
|
|
sudo apt upgrade
|
|
sudo apt install openjdk-8-jdk mariadb-server mariadb-client
|
|
mkdir ~/.librography
|
|
touch ~/.librography/
|
|
|
|
# is the mysql already configured?
|
|
# proceed with secure install:
|
|
|
|
echo "Enter the user name for database: "
|
|
read password
|
|
echo "The Current User Name is $first_name"
|
|
echo
|
|
echo "Enter other users'names: "
|
|
read name1 name2 name3
|
|
echo "$name1, $name2, $name3 are the other users."
|
|
|
|
PASS=`pwgen -s 40 1`
|
|
|
|
mysql -uroot <<MYSQL_SCRIPT
|
|
CREATE DATABASE $1;
|
|
CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS';
|
|
GRANT ALL PRIVILEGES ON $1.* TO '$1'@'localhost';
|
|
FLUSH PRIVILEGES;
|
|
MYSQL_SCRIPT
|
|
|
|
echo "MySQL user created."
|
|
echo "Username: $1"
|
|
echo "Password: $PASS" |