|
1234567891011121314151617181920212223242526272829303132333435363738 |
-
- sudo apt update
- sudo apt install mysql-server
- sudo systemctl start mysql.service
-
- sleep 2
-
- cd /
- sudo mkdir mysql_backup
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- echo "Please enter password for mysql: "
- read password
- sudo mysql -u root -p${password} -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${password}';"
- sudo sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/mysql.conf.d/mysqld.cnf
- sudo systemctl restart mysql
- echo "Please enter the IP address of app server: "
- read IP
- sudo mysql -u root -p${password} -e "CREATE USER 'root'@'${IP}' IDENTIFIED WITH mysql_native_password BY '${password}';";
- sudo mysql -u root -p${password} -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'${IP}' WITH GRANT OPTION;"
- sudo mysql -u root -p${password} -e "FLUSH PRIVILEGES;"
-
|