Advertisement
Guest User

Untitled

a guest
May 16th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. Log into MySQL databases via preconfigured aliases.
  2. Note that the alias name 'foo' is to be identified in the config file as 'clientfoo'.
  3.  
  4. ```bash
  5. $ cat ~/.bashrc
  6.  
  7. my() {
  8. /usr/bin/mysql --defaults-group-suffix="$@"
  9. }
  10.  
  11. myd() {
  12. /usr/bin/mysqldump --defaults-group-suffix="$@"
  13. }
  14.  
  15. $ ls -l ~/.my.cnf
  16. -rw------- 1 dotancohen dotancohen 245 Apr 24 17:10 /home/dotancohen/.my.cnf
  17.  
  18. $ cat ~/.my.cnf
  19.  
  20. [clientfoo]
  21. host=localhost
  22. user=root
  23. password=toor
  24.  
  25. [clientbar]
  26. host=1.2.3.4
  27. user=snowden
  28. password=letmein
  29. database=nsa_leaks
  30.  
  31. $ my foo
  32. MySQL [(none)]> exit
  33.  
  34. $ my bar
  35. MySQL [nsa_leaks]> exit
  36. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement