Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
apt update
apt -y dist-upgrade
apt -y install mariadb-server mariadb-client
read -p "Geben sie die Zahl der Schueler an: " anzahl_schueler
for (( zaehler=1; zaehler<=$anzahl_schueler; zaehler++))
echo "$username"
useradd -m -s /bin/bash "$username"
echo "$username:$pass" | chpasswd
echo "Lege Datenbank $username an!"
mysql -u root -pfbsfbs -e "CREATE DATABASE ${username};"
mysql -u root -pfbsfbs -e "CREATE USER ${username}@localhost IDENTIFIED BY '${pass}';"
mysql -u root -pfbsfbs -e "GRANT ALL PRIVILEGES ON ${username}.* TO '${username}'@'localhost';"
mysql -u root -pfbsfbs -e "FLUSH PRIVILEGES;"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment