Advertisement
Guest User

Untitled

a guest
Nov 11th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. SHELL := /bin/bash
  2.  
  3. default:
  4. @echo "Welcome!";
  5. echo -n "Please enter the MySQL host (default: localhost):";
  6. read host;
  7. host=${host:-localhost};
  8. echo -n "Please enter the MySQL username:";
  9. read username;
  10. echo -n "Please enter the MySQL password:";
  11. read -s password;
  12. mv includes/config.php.example includes/config.php 2>/dev/null;true;
  13. sed 's/"USER", ""/"USER", "$(username)"/g' includes/config.php > includes/config.php;
  14. sed 's/"PASSWORD", ""/"PASSWORD", "$(password)"/g' includes/config.php > includes/conf$
  15. echo $username;
  16. echo $password;
  17. mysql -u "$username" -p"$password" codeday-team < ./codeday-team.sql;
  18. echo "Configuration complete. For further configuration options, check the config file$
  19. exit 0;
  20.  
  21. Welcome!
  22. Please enter the MySQL host (default: localhost):
  23. Please enter the MySQL username:<snip>
  24. Please enter the MySQL password:sername
  25. assword
  26. ERROR 1045 (28000): Access denied for user 'sername'@'localhost' (using password: YES)
  27. Configuration complete. For further configuration options, check the config file includes/config.php
  28.  
  29. echo $username;
  30. echo $password;
  31.  
  32. #! /usr/bin/env bash
  33. printf 'WelcomenPlease enter the MySQL host (default: localhost): '
  34. read host || exit
  35. host=${host:-localhost}
  36. printf "Please enter the MySQL username: "
  37. read username || exit
  38. printf "Please enter the MySQL password:"
  39. IFS= read -rs password || exit
  40. mv includes/config.php.example includes/config.php 2>/dev/null
  41. repl=${password//\/\\}
  42. repl=${repl//&/\&}
  43. repl=${repl//:/\:}
  44. { rm includes/config.php &&
  45. sed 's/"USER", ""/"USER", "$username"/g
  46. s:"PASSWORD", "":"PASSWORD", "'"$repl"'"/g' > includes/config.php
  47. } < includes/config.php || exit
  48. mysql -u "$username" -p"$password" codeday-team < ./codeday-team.sql || exit
  49.  
  50. echo "Configuration complete. For further configuration options, check the config file"
  51.  
  52. mysql --defaults-file=<(
  53. printf '[client]nuser=%snpassword="%s"n' "$username" "$password") ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement