You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

trias_dbserver_script.sh 1.5KB

1234567891011121314151617181920212223242526272829303132333435
  1. #MYSQL SERVER INSTALLATION
  2. sudo apt update
  3. sudo apt install mysql-server
  4. sudo systemctl start mysql.service
  5. sleep 2
  6. #STEPS FOR MYSQL_SECURE_INSTALLATION
  7. #STEP-1 sudo mysql
  8. #STEP-2 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'SET_PASSWORD';
  9. #STEP-3 exit;
  10. #STEP-4 sudo sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/mysql.conf.d/mysqld.cnf
  11. #STEP-5 sudo systemctl restart mysql
  12. #STEP-6 mysql -u root -p
  13. #STEP-7 ALTER USER 'root'@'localhost' IDENTIFIED WITH auth_socket; AND FOLLOW THE STEPS
  14. #STEP-8 exit;
  15. #STEP-9 sudo mysql_secure_installation;
  16. #STEP-10 sudo mysql;
  17. #STEP-11 mysql -u root -p
  18. #STEP-12 "ENTER MYSQL PASSWORD THAT WAS SET IN STEP 2"
  19. #STEP-13 CREATE USER '_username_'@'_desiredIP_' IDENTIFIED WITH mysql_native_password BY 'password';
  20. #STEP-14 GRANT ALL PRIVILEGES ON *.* TO '_username_'@'_desiredIP_' WITH GRANT OPTION;
  21. #STEP-15 FLUSH PRIVILEGES;
  22. echo "Please enter password for mysql: "
  23. read password
  24. sudo mysql -u root -p${password} -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${password}'"
  25. sudo sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/mysql.conf.d/mysqld.cnf
  26. sudo systemctl restart mysql
  27. echo "Please enter the IP address of app server: "
  28. read IP
  29. sudo mysql -u root -p${password} CREATE USER 'root'@'${IP}' IDENTIFIED WITH mysql_native_password BY '${password}';
  30. sudo mysql -u root -p${password} GRANT ALL PRIVILEGES ON *.* TO 'root'@'${IP}' WITH GRANT OPTION;
  31. FLUSH PRIVILEGES;