Guest User

Untitled

a guest
Nov 2nd, 2017
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.25 KB | None | 0 0
  1. mysql -u root -p
  2.  
  3. CREATE USER 'bill'@'%' IDENTIFIED BY 'passpass';
  4.  
  5. grant all privileges on *.* to 'bill'@'%' with grant option;
  6.  
  7. mysql -u bill -p
  8.  
  9. ''@'localhost'
  10.  
  11. 'bill'@'%'
  12.  
  13. 'bill'@'%'
  14.  
  15. ~$ mysql -u root -p
  16. Enter Password:
  17.  
  18. mysql> grant all privileges on *.* to bill@localhost identified by 'pass' with grant option;
  19.  
  20. mysql -u bill -p
  21.  
  22. ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)
  23.  
  24. CREATE USER bill@localhost IDENTIFIED BY 'passpass';
  25. grant all privileges on *.* to bill@localhost with grant option;
  26.  
  27. mysql -u bill -p -hmydb@mydomain.com
  28. mysql -u bill -p -h10.1.2.30
  29. mysql -u bill -p -h127.0.0.1 --protocol=TCP
  30.  
  31. SELECT USER(),CURRENT_USER();
  32.  
  33. mysql> select user,host from mysql.user;
  34. +---------+-----------+
  35. | user | host |
  36. +---------+-----------+
  37. | lwdba | % |
  38. | mywife | % |
  39. | lwdba | 127.0.0.1 |
  40. | root | 127.0.0.1 |
  41. | lwdba | localhost |
  42. | root | localhost |
  43. | vanilla | localhost |
  44. +---------+-----------+
  45. 7 rows in set (0.00 sec)
  46.  
  47. mysql> grant all on *.* to x@'%';
  48. Query OK, 0 rows affected (0.02 sec)
  49.  
  50. mysql> select user,host from mysql.user;
  51. +---------+-----------+
  52. | user | host |
  53. +---------+-----------+
  54. | lwdba | % |
  55. | mywife | % |
  56. | x | % |
  57. | lwdba | 127.0.0.1 |
  58. | root | 127.0.0.1 |
  59. | lwdba | localhost |
  60. | root | localhost |
  61. | vanilla | localhost |
  62. +---------+-----------+
  63. 8 rows in set (0.00 sec)
  64.  
  65. mysql> update mysql.user set user='' where user='x';
  66. Query OK, 1 row affected (0.00 sec)
  67. Rows matched: 1 Changed: 1 Warnings: 0
  68.  
  69. mysql> flush privileges;
  70. Query OK, 0 rows affected (0.01 sec)
  71.  
  72. mysql> select user,host from mysql.user;
  73. +---------+-----------+
  74. | user | host |
  75. +---------+-----------+
  76. | | % |
  77. | lwdba | % |
  78. | mywife | % |
  79. | lwdba | 127.0.0.1 |
  80. | root | 127.0.0.1 |
  81. | lwdba | localhost |
  82. | root | localhost |
  83. | vanilla | localhost |
  84. +---------+-----------+
  85. 8 rows in set (0.00 sec)
  86.  
  87. mysql>
  88.  
  89. C:MySQL_5.5.12>mysql -urol -Dtest -h127.0.0.1 --protocol=TCP
  90. Welcome to the MySQL monitor. Commands end with ; or g.
  91. Your MySQL connection id is 12
  92. Server version: 5.5.12-log MySQL Community Server (GPL)
  93.  
  94. Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  95.  
  96. Oracle is a registered trademark of Oracle Corporation and/or its
  97. affiliates. Other names may be trademarks of their respective
  98. owners.
  99.  
  100. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
  101.  
  102. mysql> select user(),current_user();
  103. +---------------+----------------+
  104. | user() | current_user() |
  105. +---------------+----------------+
  106. | rol@localhost | @% |
  107. +---------------+----------------+
  108. 1 row in set (0.00 sec)
  109.  
  110. mysql>
  111.  
  112. mysql -u mike -p mypass
  113.  
  114. mysql -u mike -pmypass
  115.  
  116. [client]
  117. user = myusername
  118. password = "mypassword" # <----------------------- VERY IMPORTANT (quotes)
  119. host = localhost
  120.  
  121. ERROR 1045 (28000): Access denied for user 'sonar'@'localhost' (using password: YES)
  122.  
  123. alm-lt-test.xyz.com
  124.  
  125. mysql -u sonar -p -halm-lt-test.xyz.com
  126. mysql -u sonar -p -h101.33.65.94
  127. mysql -u sonar -p -h127.0.0.1 --protocol=TCP
  128. mysql -u sonar -p -h172.27.59.54 --protocol=TCP
  129.  
  130. GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
  131. GRANT ALL ON sonar.* TO 'sonar'@'alm-lt-test.xyz.com' IDENTIFIED BY 'sonar';
  132. GRANT ALL ON sonar.* TO 'sonar'@'127.0.0.1' IDENTIFIED BY 'sonar';
  133. GRANT ALL ON sonar.* TO 'sonar'@'172.27.59.54' IDENTIFIED BY 'sonar';
  134.  
  135. bind-address = 127.0.0.1
  136.  
  137. mysql -u debian-sys-maint -p
  138.  
  139. SQL SECURITY DEFINER
  140.  
  141. SQL SECURITY INVOKER
  142.  
  143. CREATE USER 'bill'@'%' IDENTIFIED BY 'passpass';
  144.  
  145. CREATE USER 'bill'@'localhost' IDENTIFIED BY 'passpass';
  146.  
  147. mysql> select user,host from mysql.user;
  148. +---------------+----------------------------+
  149. | user | host |
  150. +---------------+----------------------------+
  151. | bill | % | <=== created by first
  152. | root | 127.0.0.1 |
  153. | root | ::1 |
  154. | root | localhost |
  155. | bill | localhost | <=== created by second
  156. +---------------+----------------------------+
  157.  
  158. mysql -u bill -p
  159.  
  160. ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)
  161.  
  162. CREATE USER 'bill'@'localhost' IDENTIFIED BY 'passpass';
  163.  
  164. grant all privileges on . to 'bill'@'localhost' with grant option;
  165.  
  166. $ mysql -usomeuser -p's0mep@$$w0Rd'
  167.  
  168. $ mysql -usomeuser -p
  169. Enter password:
  170. Welcome to the MySQL monitor. Commands end with ; or g.
  171. Your MySQL connection id is 191
  172. Server version: 5.5.46-0ubuntu0.14.04.2 (Ubuntu)
  173.  
  174. Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  175.  
  176. Oracle is a registered trademark of Oracle Corporation and/or its
  177. affiliates. Other names may be trademarks of their respective
  178. owners.
  179.  
  180. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
  181.  
  182. mysql>
  183.  
  184. UPDATE user SET plugin='mysql_native_password' WHERE user='foo';
  185. FLUSH PRIVILEGES;
  186.  
  187. FLUSH PRIVILEGES;
  188. CREATE USER bill@localhost IDENTIFIED BY 'passpass';
  189. grant all privileges on *.* to bill@localhost with grant option;
  190. FLUSH PRIVILEGES;
  191.  
  192. UPDATE mysql.user SET user='xxxx', password=PASSWORD('xxxx') WHERE user='';
  193. FLUSH PRIVILEGES;
Add Comment
Please, Sign In to add comment