[Admin] tierrilopes Posted May 11, 2018 at 05:31 PM Share Posted May 11, 2018 at 05:31 PM Script to: Install mysql55-server Remove default users Generate random remote user with 12 length Generate random password with 64 length Script code: #!/bin/sh #### MySQL Installer #### #### tierrilopes #### #### tlthings.net #### #Installation passwords v_gen_password=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 60 | head -n 1) v_gen_remote_user=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1) v_gen_mysqladmin_password=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 60 | head -n 1) #Color stuff cecho () { echo -e "\033[36m$1\033[0m"; } echo Updating system and installing packges... pkg update && pkg upgrade -y && pkg install -y mysql55-server wget echo Configuring mysql-server... pwd_mkdb -p /etc/master.passwd sysrc mysql_enable="YES" service mysql-server start #makes sure enough time passed to start mysql-server sleep 5 #Gives max permissions to folders and sub-folders chown -R mysql /var/db/mysql chgrp -R mysql /var/db/mysql ## Set localhost default admin password /usr/local/bin/mysqladmin -uroot password "$v_gen_mysqladmin_password" ##Create remote access mysql user echo Creating mysql user with remote access... mysql -uroot -p$v_gen_mysqladmin_password mysql -e"DROP DATABASE IF EXISTS test;" mysql -uroot -p$v_gen_mysqladmin_password mysql -e"DELETE FROM mysql.user WHERE Host='';" mysql -uroot -p$v_gen_mysqladmin_password mysql -e"DELETE FROM mysql.user WHERE Host='%';" mysql -uroot -p$v_gen_mysqladmin_password mysql -e"DELETE FROM mysql.user WHERE Password='';" mysql -uroot -p$v_gen_mysqladmin_password mysql -e"GRANT ALL PRIVILEGES ON *.* TO '$v_gen_remote_user'@'%' IDENTIFIED BY '$v_gen_password' WITH GRANT OPTION;" mysql -uroot -p$v_gen_mysqladmin_password mysql -e"FLUSH PRIVILEGES;" #Outputs MySQL information echo MySQL remote user: $v_gen_remote_user echo -e MySQL remote password: $v_gen_password echo -e MySQL IP address: $(wget checkip.dyndns.org:80 --no-check-certificate -O - -o /dev/null | cut -d" " -f6 | sed 's/<\/body><\/html>//') echo cecho "MySQL installation completed" cecho "tierrilopes" cecho "tlthings.net" NOTE: TO BE USED ON A FRESH INSTALL OF FREEBSD Regards, Tierri Lopes. mysql_installer.sh Link to comment
trample Posted May 11, 2018 at 07:59 PM Share Posted May 11, 2018 at 07:59 PM Qual a diferença disso com o pkg delet e pkg install ? sem contar que ningem usa as portsnap . qual a diferença de usar um mysql antigo con versoens mais recentes? o pessoal fala qe maria db e seguro sendo que nem tem mais atualizaçoens para ela , para mim nao passa d um projeto falido . Link to comment
[Admin] tierrilopes Posted May 11, 2018 at 08:31 PM Author Share Posted May 11, 2018 at 08:31 PM Que pkg delete? Isso é melhor veres o changelog deles que diz todas as mudanças Ambos são seguros se bem configurados Link to comment
trample Posted May 12, 2018 at 12:51 PM Share Posted May 12, 2018 at 12:51 PM é pq tipo o mysql parou e a oracle ficou com o projeto Olha a mariadb as atualizaçoens novas como ficou eu ja estou fazendo testes a dias com diversos bancos ao meu ver as recentes atualizaçoens estao melhorando porem ainda contem bugs :/ Link to comment
Recommended Posts