Advertisement
FR4GG13

[Bazy danych] 12.10

Oct 12th, 2017
480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 45.34 KB | None | 0 0
  1. student@linux:~> mysql -u root -p
  2. Enter password:
  3. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
  4. student@linux:~> mysql -u root -p
  5. Enter password:
  6. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
  7. student@linux:~> mysql -u root -p
  8. Enter password:
  9. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
  10. student@linux:~> clear
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. student@linux:~> mysql -u admin -p
  31. Enter password:
  32. Welcome to the MariaDB monitor. Commands end with ; or \g.
  33. Your MariaDB connection id is 10
  34. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  35.  
  36. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  37.  
  38. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  39.  
  40. MariaDB [(none)]> exit
  41. Bye
  42. student@linux:~> mysql -u admin -p
  43. Enter password:
  44. Welcome to the MariaDB monitor. Commands end with ; or \g.
  45. Your MariaDB connection id is 11
  46. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  47.  
  48. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  49.  
  50. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  51.  
  52. MariaDB [(none)]> \h
  53.  
  54. General information about MariaDB can be found at
  55. http://mariadb.org
  56.  
  57. List of all MySQL commands:
  58. Note that all text commands must be first on line and end with ';'
  59. ? (\?) Synonym for `help'.
  60. clear (\c) Clear the current input statement.
  61. connect (\r) Reconnect to the server. Optional arguments are db and host.
  62. delimiter (\d) Set statement delimiter.
  63. edit (\e) Edit command with $EDITOR.
  64. ego (\G) Send command to mysql server, display result vertically.
  65. exit (\q) Exit mysql. Same as quit.
  66. go (\g) Send command to mysql server.
  67. help (\h) Display this help.
  68. nopager (\n) Disable pager, print to stdout.
  69. notee (\t) Don't write into outfile.
  70. pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
  71. print (\p) Print current command.
  72. prompt (\R) Change your mysql prompt.
  73. quit (\q) Quit mysql.
  74. rehash (\#) Rebuild completion hash.
  75. source (\.) Execute an SQL script file. Takes a file name as an argument.
  76. status (\s) Get status information from the server.
  77. system (\!) Execute a system shell command.
  78. tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
  79. use (\u) Use another database. Takes database name as argument.
  80. charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
  81. warnings (\W) Show warnings after every statement.
  82. nowarning (\w) Don't show warnings after every statement.
  83.  
  84. For server side help, type 'help contents'
  85.  
  86. MariaDB [(none)]> student@linux:~> mysql -u admin -p admin
  87. -> Enter password:
  88. -> ERROR 1049 (42000): Unknown database 'admin'
  89. -> student@linux:~> clear
  90. ->
  91. ->
  92. ->
  93. ->
  94. ->
  95. ->
  96. ->
  97. ->
  98. ->
  99. ->
  100. ->
  101. ->
  102. ->
  103. ->
  104. ->
  105. ->
  106. ->
  107. ->
  108. ->
  109. ->
  110. ->
  111. ->
  112. ->
  113. ->
  114. ->
  115. -> student@linux:~> mysql -u admin -p
  116. -> Enter password:
  117. -> Welcome to the MariaDB monitor. Commands end with ; or \g.
  118. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'student@linux:~> mysql -u admin -p admin
  119. Enter password:
  120. ERROR 1049 (42000): Un' at line 1
  121. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'or' at line 1
  122. -> Your MariaDB connection id is 6
  123. -> Server version: 10.0.31-MariaDB SLE 12 SP1 package
  124. ->
  125. -> Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  126. ->
  127. -> Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  128. ->
  129. -> MariaDB [(none)]> +
  130. ->
  131. ->
  132. ->
  133. ->
  134. ->
  135. ->
  136. ->
  137. ->
  138. ->
  139. ->
  140. ->
  141. ->
  142. ->
  143. ->
  144. ->
  145. ->
  146. ->
  147. ->
  148. ->
  149. -> cokolwiek
  150. -> nie
  151. -> nie wiem
  152. -> \c
  153. MariaDB [(none)]> mysql -u admin -p
  154. -> admin
  155. -> \c
  156. MariaDB [(none)]> \c
  157. MariaDB [(none)]> show grant
  158. -> show grants
  159. -> \c
  160. MariaDB [(none)]> show grants;
  161. +---------------------------------------------------------------------------------------------------------------------------------+
  162. | Grants for admin@% |
  163. +---------------------------------------------------------------------------------------------------------------------------------+
  164. | GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' IDENTIFIED BY PASSWORD '*4ACFE3202A5FF5CF467898FC58AAB1D615029441' WITH GRANT OPTION |
  165. +---------------------------------------------------------------------------------------------------------------------------------+
  166. 1 row in set (0.00 sec)
  167.  
  168. MariaDB [(none)]> show grants for root
  169. -> ;
  170. ERROR 1141 (42000): There is no such grant defined for user 'root' on host '%'
  171. MariaDB [(none)]> show database
  172. ->
  173. -> ;
  174. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database' at line 1
  175. MariaDB [(none)]> show database;
  176. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database' at line 1
  177. MariaDB [(none)]> SELECT * FROM user
  178. -> ;
  179. ERROR 1046 (3D000): No database selected
  180. MariaDB [(none)]> show databases
  181. -> ;
  182. +--------------------+
  183. | Database |
  184. +--------------------+
  185. | information_schema |
  186. | mysql |
  187. | performance_schema |
  188. +--------------------+
  189. 3 rows in set (0.29 sec)
  190.  
  191. MariaDB [(none)]> use mysql;
  192. Reading table information for completion of table and column names
  193. You can turn off this feature to get a quicker startup with -A
  194.  
  195. Database changed
  196. MariaDB [mysql]> show tables
  197. -> ;
  198. +---------------------------+
  199. | Tables_in_mysql |
  200. +---------------------------+
  201. | column_stats |
  202. | columns_priv |
  203. | db |
  204. | event |
  205. | func |
  206. | general_log |
  207. | gtid_slave_pos |
  208. | help_category |
  209. | help_keyword |
  210. | help_relation |
  211. | help_topic |
  212. | host |
  213. | index_stats |
  214. | innodb_index_stats |
  215. | innodb_table_stats |
  216. | plugin |
  217. | proc |
  218. | procs_priv |
  219. | proxies_priv |
  220. | roles_mapping |
  221. | servers |
  222. | slow_log |
  223. | table_stats |
  224. | tables_priv |
  225. | time_zone |
  226. | time_zone_leap_second |
  227. | time_zone_name |
  228. | time_zone_transition |
  229. | time_zone_transition_type |
  230. | user |
  231. +---------------------------+
  232. 30 rows in set (0.00 sec)
  233.  
  234. MariaDB [mysql]> select * FROM user
  235. -> ;
  236. +-----------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+---------+
  237. | Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin | authentication_string | password_expired | is_role |
  238. +-----------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+---------+
  239. | localhost | root | *1308E0FCD43112F8D948AB093F54892CB7B220AA | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | | | N | N |
  240. | 127.0.0.1 | root | *1308E0FCD43112F8D948AB093F54892CB7B220AA | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | | | N | N |
  241. | ::1 | root | *1308E0FCD43112F8D948AB093F54892CB7B220AA | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | | | N | N |
  242. | % | admin | *4ACFE3202A5FF5CF467898FC58AAB1D615029441 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | | | N | N |
  243. +-----------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+---------+
  244. 4 rows in set (0.00 sec)
  245.  
  246. MariaDB [mysql]> \h
  247.  
  248. General information about MariaDB can be found at
  249. http://mariadb.org
  250.  
  251. List of all MySQL commands:
  252. Note that all text commands must be first on line and end with ';'
  253. ? (\?) Synonym for `help'.
  254. clear (\c) Clear the current input statement.
  255. connect (\r) Reconnect to the server. Optional arguments are db and host.
  256. delimiter (\d) Set statement delimiter.
  257. edit (\e) Edit command with $EDITOR.
  258. ego (\G) Send command to mysql server, display result vertically.
  259. exit (\q) Exit mysql. Same as quit.
  260. go (\g) Send command to mysql server.
  261. help (\h) Display this help.
  262. nopager (\n) Disable pager, print to stdout.
  263. notee (\t) Don't write into outfile.
  264. pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
  265. print (\p) Print current command.
  266. prompt (\R) Change your mysql prompt.
  267. quit (\q) Quit mysql.
  268. rehash (\#) Rebuild completion hash.
  269. source (\.) Execute an SQL script file. Takes a file name as an argument.
  270. status (\s) Get status information from the server.
  271. system (\!) Execute a system shell command.
  272. tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
  273. use (\u) Use another database. Takes database name as argument.
  274. charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
  275. warnings (\W) Show warnings after every statement.
  276. nowarning (\w) Don't show warnings after every statement.
  277.  
  278. For server side help, type 'help contents'
  279.  
  280. MariaDB [mysql]> use performance_schema
  281. Reading table information for completion of table and column names
  282. You can turn off this feature to get a quicker startup with -A
  283.  
  284. Database changed
  285. MariaDB [performance_schema]> select * from user
  286. -> ;
  287. ERROR 1146 (42S02): Table 'performance_schema.user' doesn't exist
  288. MariaDB [performance_schema]> select host, user from user;
  289. ERROR 1146 (42S02): Table 'performance_schema.user' doesn't exist
  290. MariaDB [performance_schema]> select host, user from mysql.user;
  291. +-----------+-------+
  292. | host | user |
  293. +-----------+-------+
  294. | % | admin |
  295. | 127.0.0.1 | root |
  296. | ::1 | root |
  297. | localhost | root |
  298. +-----------+-------+
  299. 4 rows in set (0.00 sec)
  300.  
  301. MariaDB [performance_schema]> use mysql
  302. Reading table information for completion of table and column names
  303. You can turn off this feature to get a quicker startup with -A
  304.  
  305. Database changed
  306. MariaDB [mysql]> select * FROM mysql.db;
  307. Empty set (0.00 sec)
  308.  
  309. MariaDB [mysql]> Ctrl-C -- exit!
  310. Aborted
  311. student@linux:~> mysql -u admin -p
  312. Enter password:
  313. Welcome to the MariaDB monitor. Commands end with ; or \g.
  314. Your MariaDB connection id is 12
  315. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  316.  
  317. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  318.  
  319. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  320.  
  321. MariaDB [(none)]> exit
  322. Bye
  323. student@linux:~> mysql -u root -p
  324. Enter password:
  325. Welcome to the MariaDB monitor. Commands end with ; or \g.
  326. Your MariaDB connection id is 13
  327. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  328.  
  329. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  330.  
  331. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  332.  
  333. MariaDB [(none)]> exit
  334. Bye
  335. student@linux:~> mysql -u admin -p
  336. Enter password:
  337. Welcome to the MariaDB monitor. Commands end with ; or \g.
  338. Your MariaDB connection id is 14
  339. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  340.  
  341. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  342.  
  343. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  344.  
  345. MariaDB [(none)]> select version();
  346. +-----------------+
  347. | version() |
  348. +-----------------+
  349. | 10.0.31-MariaDB |
  350. +-----------------+
  351. 1 row in set (0.00 sec)
  352.  
  353. MariaDB [(none)]> desc mysqd.db;
  354. ERROR 1146 (42S02): Table 'mysqd.db' doesn't exist
  355. MariaDB [(none)]> desc db;
  356. ERROR 1046 (3D000): No database selected
  357. MariaDB [(none)]> desc db
  358. -> mysql -u admin -p
  359. -> admin
  360. -> Ctrl-C -- exit!
  361. Aborted
  362. student@linux:~> mysql -u admin -p
  363. Enter password:
  364. Welcome to the MariaDB monitor. Commands end with ; or \g.
  365. Your MariaDB connection id is 15
  366. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  367.  
  368. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  369.  
  370. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  371.  
  372. MariaDB [(none)]> use mysql;
  373. Reading table information for completion of table and column names
  374. You can turn off this feature to get a quicker startup with -A
  375.  
  376. Database changed
  377. MariaDB [mysql]> desc db;
  378. +-----------------------+---------------+------+-----+---------+-------+
  379. | Field | Type | Null | Key | Default | Extra |
  380. +-----------------------+---------------+------+-----+---------+-------+
  381. | Host | char(60) | NO | PRI | | |
  382. | Db | char(64) | NO | PRI | | |
  383. | User | char(80) | NO | PRI | | |
  384. | Select_priv | enum('N','Y') | NO | | N | |
  385. | Insert_priv | enum('N','Y') | NO | | N | |
  386. | Update_priv | enum('N','Y') | NO | | N | |
  387. | Delete_priv | enum('N','Y') | NO | | N | |
  388. | Create_priv | enum('N','Y') | NO | | N | |
  389. | Drop_priv | enum('N','Y') | NO | | N | |
  390. | Grant_priv | enum('N','Y') | NO | | N | |
  391. | References_priv | enum('N','Y') | NO | | N | |
  392. | Index_priv | enum('N','Y') | NO | | N | |
  393. | Alter_priv | enum('N','Y') | NO | | N | |
  394. | Create_tmp_table_priv | enum('N','Y') | NO | | N | |
  395. | Lock_tables_priv | enum('N','Y') | NO | | N | |
  396. | Create_view_priv | enum('N','Y') | NO | | N | |
  397. | Show_view_priv | enum('N','Y') | NO | | N | |
  398. | Create_routine_priv | enum('N','Y') | NO | | N | |
  399. | Alter_routine_priv | enum('N','Y') | NO | | N | |
  400. | Execute_priv | enum('N','Y') | NO | | N | |
  401. | Event_priv | enum('N','Y') | NO | | N | |
  402. | Trigger_priv | enum('N','Y') | NO | | N | |
  403. +-----------------------+---------------+------+-----+---------+-------+
  404. 22 rows in set (0.00 sec)
  405.  
  406. MariaDB [mysql]> grant all on *.* to adminek1;
  407. Query OK, 0 rows affected (0.01 sec)
  408.  
  409. MariaDB [mysql]> show grants for adminek1;
  410. +-----------------------------------------------+
  411. | Grants for adminek1@% |
  412. +-----------------------------------------------+
  413. | GRANT ALL PRIVILEGES ON *.* TO 'adminek1'@'%' |
  414. +-----------------------------------------------+
  415. 1 row in set (0.00 sec)
  416.  
  417. MariaDB [mysql]> SELECT user from mysql.user;
  418. +----------+
  419. | user |
  420. +----------+
  421. | admin |
  422. | adminek1 |
  423. | root |
  424. | root |
  425. | root |
  426. +----------+
  427. 5 rows in set (0.00 sec)
  428.  
  429. MariaDB [mysql]> mysql -u adminek1 -p
  430. -> show grants;
  431. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'mysql -u adminek1 -p
  432. show grants' at line 1
  433. MariaDB [mysql]> mysql -u adminek1 -p
  434. -> exit
  435. -> Bye
  436. student@linux:~> use mysql
  437. If 'use' is not a typo you can use command-not-found to lookup the package that contains it, like this:
  438. cnf use
  439. student@linux:~> mysql -u admin -p
  440. Enter password:
  441. Welcome to the MariaDB monitor. Commands end with ; or \g.
  442. Your MariaDB connection id is 16
  443. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  444.  
  445. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  446.  
  447. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  448.  
  449. MariaDB [(none)]> grant all on *.* to adminek2 identified pass;
  450. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'pass' at line 1
  451. MariaDB [(none)]> grant all on *.* to adminek2 identified by pass;
  452. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'pass' at line 1
  453. MariaDB [(none)]> grant all on *.* to adminek2 identified by 'pass';
  454. Query OK, 0 rows affected (0.00 sec)
  455.  
  456. MariaDB [(none)]> grant all on *.* to 'adminek2'@'localhost' identified by 'pass';
  457. Query OK, 0 rows affected (0.00 sec)
  458.  
  459. MariaDB [(none)]> show grants adminek2;
  460. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'adminek2' at line 1
  461. MariaDB [(none)]> show grants adminek2@localhost;
  462. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'adminek2@localhost' at line 1
  463. MariaDB [(none)]> show grants for adminek2@localhost;
  464. +--------------------------------------------------------------------------------------------------------------------------+
  465. | Grants for adminek2@localhost |
  466. +--------------------------------------------------------------------------------------------------------------------------+
  467. | GRANT ALL PRIVILEGES ON *.* TO 'adminek2'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7' |
  468. +--------------------------------------------------------------------------------------------------------------------------+
  469. 1 row in set (0.00 sec)
  470.  
  471. MariaDB [(none)]> exit
  472. Bye
  473. student@linux:~> mysql -u adminek2 -p
  474. Enter password:
  475. Welcome to the MariaDB monitor. Commands end with ; or \g.
  476. Your MariaDB connection id is 17
  477. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  478.  
  479. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  480.  
  481. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  482.  
  483. MariaDB [(none)]> exit
  484. Bye
  485. student@linux:~> mysql -u admin -p
  486. Enter password:
  487. Welcome to the MariaDB monitor. Commands end with ; or \g.
  488. Your MariaDB connection id is 18
  489. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  490.  
  491. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  492.  
  493. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  494.  
  495. MariaDB [(none)]> UPDATE mysql user SET Password=PASSWORD('pass') WHERE user='adminek1';
  496. ERROR 1046 (3D000): No database selected
  497. MariaDB [(none)]> UPDATE mysql.user SET Password=PASSWORD('pass') WHERE user='adminek1';
  498. Query OK, 1 row affected (0.28 sec)
  499. Rows matched: 1 Changed: 1 Warnings: 0
  500.  
  501. MariaDB [(none)]> exit
  502. Bye
  503. student@linux:~> mysql -u admin -p
  504. Enter password:
  505. Welcome to the MariaDB monitor. Commands end with ; or \g.
  506. Your MariaDB connection id is 19
  507. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  508.  
  509. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  510.  
  511. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  512.  
  513. MariaDB [(none)]> UPDATE mysql.user SET Password=PASSWORD('pass') WHERE user='adminek1';
  514. Query OK, 0 rows affected (0.00 sec)
  515. Rows matched: 1 Changed: 0 Warnings: 0
  516.  
  517. MariaDB [(none)]> flush privileges;
  518. Query OK, 0 rows affected (0.00 sec)
  519.  
  520. MariaDB [(none)]> SET PASSWORD FOR adminek1=PASSWORD('mypass');
  521. Query OK, 0 rows affected (0.00 sec)
  522.  
  523. MariaDB [(none)]> exit
  524. Bye
  525. student@linux:~> mysql -u adminek1 -p
  526. Enter password:
  527. Welcome to the MariaDB monitor. Commands end with ; or \g.
  528. Your MariaDB connection id is 20
  529. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  530.  
  531. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  532.  
  533. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  534.  
  535. MariaDB [(none)]> exit
  536. Bye
  537. student@linux:~> mysql -u admin -p
  538. Enter password:
  539. Welcome to the MariaDB monitor. Commands end with ; or \g.
  540. Your MariaDB connection id is 21
  541. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  542.  
  543. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  544.  
  545. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  546.  
  547. MariaDB [(none)]> SELECT user.db FROM mysql.db;
  548. ERROR 1054 (42S22): Unknown column 'user.db' in 'field list'
  549. MariaDB [(none)]> SELECT grant ala on ala.* to adminek1;
  550. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'grant ala on ala.* to adminek1' at line 1
  551. MariaDB [(none)]> SELECT grant all on ala.* to adminek1
  552. -> SELECT grant all on ala.* to adminek1;
  553. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'grant all on ala.* to adminek1
  554. SELECT grant all on ala.* to adminek1' at line 1
  555. MariaDB [(none)]> all privileges ala
  556. -> mysql db
  557. -> ;
  558. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'all privileges ala
  559. mysql db' at line 1
  560. MariaDB [(none)]> select user.db FROM mysql.db
  561. -> ;
  562. ERROR 1054 (42S22): Unknown column 'user.db' in 'field list'
  563. MariaDB [(none)]> all privileges ala mysql.db;
  564. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'all privileges ala mysql.db' at line 1
  565. MariaDB [(none)]> revoke all on ala.* from adminek1;
  566. ERROR 1141 (42000): There is no such grant defined for user 'adminek1' on host '%'
  567. MariaDB [(none)]> exit
  568. Bye
  569. student@linux:~> mysql -u adminek1 -p
  570. Enter password:
  571. Welcome to the MariaDB monitor. Commands end with ; or \g.
  572. Your MariaDB connection id is 22
  573. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  574.  
  575. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  576.  
  577. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  578.  
  579. MariaDB [(none)]> revoke all on ala.* from adminek1
  580. -> ;
  581. ERROR 1044 (42000): Access denied for user 'adminek1'@'%' to database 'ala'
  582. MariaDB [(none)]> show db from adminek1
  583. -> l
  584. -> ;
  585. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'db from adminek1
  586. l' at line 1
  587. MariaDB [(none)]> show db from adminek1;
  588. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'db from adminek1' at line 1
  589. MariaDB [(none)]> GRANT SELECT,INSERT,UPDATE ON ala.* TO adminek1;
  590. ERROR 1044 (42000): Access denied for user 'adminek1'@'%' to database 'ala'
  591. MariaDB [(none)]> select * from mysql.user;
  592. +-----------+----------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+---------+
  593. | Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin | authentication_string | password_expired | is_role |
  594. +-----------+----------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+---------+
  595. | localhost | root | *1308E0FCD43112F8D948AB093F54892CB7B220AA | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | | | N | N |
  596. | 127.0.0.1 | root | *1308E0FCD43112F8D948AB093F54892CB7B220AA | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | | | N | N |
  597. | ::1 | root | *1308E0FCD43112F8D948AB093F54892CB7B220AA | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | | | N | N |
  598. | % | admin | *4ACFE3202A5FF5CF467898FC58AAB1D615029441 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | | | N | N |
  599. | % | adminek1 | *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | | | N | N |
  600. | % | adminek2 | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | | | N | N |
  601. | localhost | adminek2 | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | | | N | N |
  602. +-----------+----------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+---------+
  603. 7 rows in set (0.00 sec)
  604.  
  605. MariaDB [(none)]> Ctrl-C -- exit!
  606. Aborted
  607. student@linux:~> mysql -u admin -p
  608. Enter password:
  609. ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)
  610. student@linux:~> mysql -u admin -p
  611. Enter password:
  612. ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)
  613. student@linux:~> mysql -u admin -p
  614. Enter password:
  615. Welcome to the MariaDB monitor. Commands end with ; or \g.
  616. Your MariaDB connection id is 25
  617. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  618.  
  619. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  620.  
  621. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  622.  
  623. MariaDB [(none)]> DELETE FROM mysql.user WHERE User='adminek1';
  624. Query OK, 1 row affected (0.00 sec)
  625.  
  626. MariaDB [(none)]> FLUSH PRIVILEGES
  627. -> ;
  628. Query OK, 0 rows affected (0.00 sec)
  629.  
  630. MariaDB [(none)]> select user from mysql.user;
  631. +----------+
  632. | user |
  633. +----------+
  634. | admin |
  635. | adminek2 |
  636. | root |
  637. | root |
  638. | adminek2 |
  639. | root |
  640. +----------+
  641. 6 rows in set (0.00 sec)
  642.  
  643. MariaDB [(none)]> DELETE FROM mysql.user WHERE User='adminek2@localhost';
  644. Query OK, 0 rows affected (0.00 sec)
  645.  
  646. MariaDB [(none)]> FLUSH PRIVILEGES
  647. -> ;
  648. Query OK, 0 rows affected (0.00 sec)
  649.  
  650. MariaDB [(none)]> select user from mysql.user;
  651. +----------+
  652. | user |
  653. +----------+
  654. | admin |
  655. | adminek2 |
  656. | root |
  657. | root |
  658. | adminek2 |
  659. | root |
  660. +----------+
  661. 6 rows in set (0.00 sec)
  662.  
  663. MariaDB [(none)]> DELETE FROM mysql.db WHERE User='adminek1';
  664. Query OK, 0 rows affected (0.00 sec)
  665.  
  666. MariaDB [(none)]> FLUSH PRIVILEGES
  667. -> ;
  668. Query OK, 0 rows affected (0.00 sec)
  669.  
  670. MariaDB [(none)]> select user from mysql.user;
  671. +----------+
  672. | user |
  673. +----------+
  674. | admin |
  675. | adminek2 |
  676. | root |
  677. | root |
  678. | adminek2 |
  679. | root |
  680. +----------+
  681. 6 rows in set (0.00 sec)
  682.  
  683. MariaDB [(none)]> DELETE FROM mysql.db WHERE User='adminek2';
  684. Query OK, 0 rows affected (0.00 sec)
  685.  
  686. MariaDB [(none)]> FLUSH PRIVILEGES
  687. -> ;
  688. Query OK, 0 rows affected (0.00 sec)
  689.  
  690. MariaDB [(none)]> select user from mysql.user;
  691. +----------+
  692. | user |
  693. +----------+
  694. | admin |
  695. | adminek2 |
  696. | root |
  697. | root |
  698. | adminek2 |
  699. | root |
  700. +----------+
  701. 6 rows in set (0.00 sec)
  702.  
  703. MariaDB [(none)]> select user from mysql.db;
  704. Empty set (0.00 sec)
  705.  
  706. MariaDB [(none)]> select user from mysql.admin;
  707. ERROR 1146 (42S02): Table 'mysql.admin' doesn't exist
  708. MariaDB [(none)]> select user from mysql.user;
  709. +----------+
  710. | user |
  711. +----------+
  712. | admin |
  713. | adminek2 |
  714. | root |
  715. | root |
  716. | adminek2 |
  717. | root |
  718. +----------+
  719. 6 rows in set (0.00 sec)
  720.  
  721. MariaDB [(none)]> grant all on *.* to stud1 identified by 'hw1';
  722. Query OK, 0 rows affected (0.00 sec)
  723.  
  724. MariaDB [(none)]> FLUSH PRIVILEGES;
  725. Query OK, 0 rows affected (0.00 sec)
  726.  
  727. MariaDB [(none)]> exit
  728. Bye
  729. student@linux:~> mysql -u stud1 -p
  730. Enter password:
  731. Welcome to the MariaDB monitor. Commands end with ; or \g.
  732. Your MariaDB connection id is 26
  733. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  734.  
  735. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  736.  
  737. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  738.  
  739. MariaDB [(none)]> exit
  740. Bye
  741. student@linux:~> mysql -u admin -p
  742. Enter password:
  743. Welcome to the MariaDB monitor. Commands end with ; or \g.
  744. Your MariaDB connection id is 27
  745. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  746.  
  747. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  748.  
  749. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  750.  
  751. MariaDB [(none)]> grant all on hw1.* to stud1 identified by 'hw1';
  752. Query OK, 0 rows affected (0.00 sec)
  753.  
  754. MariaDB [(none)]> FLUSH PRIVILEGES
  755. -> ;
  756. Query OK, 0 rows affected (0.00 sec)
  757.  
  758. MariaDB [(none)]> show grants for stud1;
  759. +---------------------------------------------------------------------------------------------------------------+
  760. | Grants for stud1@% |
  761. +---------------------------------------------------------------------------------------------------------------+
  762. | GRANT ALL PRIVILEGES ON *.* TO 'stud1'@'%' IDENTIFIED BY PASSWORD '*E742D6D0D131BE247A6042FEE41F4639E3732765' |
  763. | GRANT ALL PRIVILEGES ON `hw1`.* TO 'stud1'@'%' |
  764. +---------------------------------------------------------------------------------------------------------------+
  765. 2 rows in set (0.00 sec)
  766.  
  767. MariaDB [(none)]> revoke all on *.* from stud1;
  768. Query OK, 0 rows affected (0.00 sec)
  769.  
  770. MariaDB [(none)]> flush privileges
  771. -> ;
  772. Query OK, 0 rows affected (0.00 sec)
  773.  
  774. MariaDB [(none)]> show grants for stud1;
  775. +------------------------------------------------------------------------------------------------------+
  776. | Grants for stud1@% |
  777. +------------------------------------------------------------------------------------------------------+
  778. | GRANT USAGE ON *.* TO 'stud1'@'%' IDENTIFIED BY PASSWORD '*E742D6D0D131BE247A6042FEE41F4639E3732765' |
  779. | GRANT ALL PRIVILEGES ON `hw1`.* TO 'stud1'@'%' |
  780. +------------------------------------------------------------------------------------------------------+
  781. 2 rows in set (0.00 sec)
  782.  
  783. MariaDB [(none)]> exit
  784. Bye
  785. student@linux:~> mysql -u stud1 -p
  786. Enter password:
  787. Welcome to the MariaDB monitor. Commands end with ; or \g.
  788. Your MariaDB connection id is 28
  789. Server version: 10.0.31-MariaDB SLE 12 SP1 package
  790.  
  791. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  792.  
  793. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  794.  
  795. MariaDB [(none)]> show grants for stud1
  796. -> ;
  797. +------------------------------------------------------------------------------------------------------+
  798. | Grants for stud1@% |
  799. +------------------------------------------------------------------------------------------------------+
  800. | GRANT USAGE ON *.* TO 'stud1'@'%' IDENTIFIED BY PASSWORD '*E742D6D0D131BE247A6042FEE41F4639E3732765' |
  801. | GRANT ALL PRIVILEGES ON `hw1`.* TO 'stud1'@'%' |
  802. +------------------------------------------------------------------------------------------------------+
  803. 2 rows in set (0.00 sec)
  804.  
  805. MariaDB [(none)]> CREATE database ala;
  806. ERROR 1044 (42000): Access denied for user 'stud1'@'%' to database 'ala'
  807. MariaDB [(none)]> show databases;
  808. +--------------------+
  809. | Database |
  810. +--------------------+
  811. | information_schema |
  812. +--------------------+
  813. 1 row in set (0.00 sec)
  814.  
  815. MariaDB [(none)]> CREATE database hw1;
  816. Query OK, 1 row affected (0.00 sec)
  817.  
  818. MariaDB [(none)]> show databases;
  819. +--------------------+
  820. | Database |
  821. +--------------------+
  822. | hw1 |
  823. | information_schema |
  824. +--------------------+
  825. 2 rows in set (0.00 sec)
  826.  
  827. MariaDB [(none)]>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement