Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- student@linux:~> mysql -u root -p
- Enter password:
- ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- student@linux:~> mysql -u root -p
- Enter password:
- ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- student@linux:~> mysql -u root -p
- Enter password:
- ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- student@linux:~> clear
- student@linux:~> mysql -u admin -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 10
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> exit
- Bye
- student@linux:~> mysql -u admin -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 11
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> \h
- General information about MariaDB can be found at
- http://mariadb.org
- List of all MySQL commands:
- Note that all text commands must be first on line and end with ';'
- ? (\?) Synonym for `help'.
- clear (\c) Clear the current input statement.
- connect (\r) Reconnect to the server. Optional arguments are db and host.
- delimiter (\d) Set statement delimiter.
- edit (\e) Edit command with $EDITOR.
- ego (\G) Send command to mysql server, display result vertically.
- exit (\q) Exit mysql. Same as quit.
- go (\g) Send command to mysql server.
- help (\h) Display this help.
- nopager (\n) Disable pager, print to stdout.
- notee (\t) Don't write into outfile.
- pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
- print (\p) Print current command.
- prompt (\R) Change your mysql prompt.
- quit (\q) Quit mysql.
- rehash (\#) Rebuild completion hash.
- source (\.) Execute an SQL script file. Takes a file name as an argument.
- status (\s) Get status information from the server.
- system (\!) Execute a system shell command.
- tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
- use (\u) Use another database. Takes database name as argument.
- charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
- warnings (\W) Show warnings after every statement.
- nowarning (\w) Don't show warnings after every statement.
- For server side help, type 'help contents'
- MariaDB [(none)]> student@linux:~> mysql -u admin -p admin
- -> Enter password:
- -> ERROR 1049 (42000): Unknown database 'admin'
- -> student@linux:~> clear
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- -> student@linux:~> mysql -u admin -p
- -> Enter password:
- -> Welcome to the MariaDB monitor. Commands end with ; or \g.
- 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
- Enter password:
- ERROR 1049 (42000): Un' at line 1
- 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
- -> Your MariaDB connection id is 6
- -> Server version: 10.0.31-MariaDB SLE 12 SP1 package
- ->
- -> Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- ->
- -> Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- ->
- -> MariaDB [(none)]> +
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- ->
- -> cokolwiek
- -> nie
- -> nie wiem
- -> \c
- MariaDB [(none)]> mysql -u admin -p
- -> admin
- -> \c
- MariaDB [(none)]> \c
- MariaDB [(none)]> show grant
- -> show grants
- -> \c
- MariaDB [(none)]> show grants;
- +---------------------------------------------------------------------------------------------------------------------------------+
- | Grants for admin@% |
- +---------------------------------------------------------------------------------------------------------------------------------+
- | GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' IDENTIFIED BY PASSWORD '*4ACFE3202A5FF5CF467898FC58AAB1D615029441' WITH GRANT OPTION |
- +---------------------------------------------------------------------------------------------------------------------------------+
- 1 row in set (0.00 sec)
- MariaDB [(none)]> show grants for root
- -> ;
- ERROR 1141 (42000): There is no such grant defined for user 'root' on host '%'
- MariaDB [(none)]> show database
- ->
- -> ;
- 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
- MariaDB [(none)]> show database;
- 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
- MariaDB [(none)]> SELECT * FROM user
- -> ;
- ERROR 1046 (3D000): No database selected
- MariaDB [(none)]> show databases
- -> ;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | mysql |
- | performance_schema |
- +--------------------+
- 3 rows in set (0.29 sec)
- MariaDB [(none)]> use mysql;
- Reading table information for completion of table and column names
- You can turn off this feature to get a quicker startup with -A
- Database changed
- MariaDB [mysql]> show tables
- -> ;
- +---------------------------+
- | Tables_in_mysql |
- +---------------------------+
- | column_stats |
- | columns_priv |
- | db |
- | event |
- | func |
- | general_log |
- | gtid_slave_pos |
- | help_category |
- | help_keyword |
- | help_relation |
- | help_topic |
- | host |
- | index_stats |
- | innodb_index_stats |
- | innodb_table_stats |
- | plugin |
- | proc |
- | procs_priv |
- | proxies_priv |
- | roles_mapping |
- | servers |
- | slow_log |
- | table_stats |
- | tables_priv |
- | time_zone |
- | time_zone_leap_second |
- | time_zone_name |
- | time_zone_transition |
- | time_zone_transition_type |
- | user |
- +---------------------------+
- 30 rows in set (0.00 sec)
- MariaDB [mysql]> select * FROM user
- -> ;
- +-----------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+---------+
- | 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 |
- +-----------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+---------+
- | 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 |
- | 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 |
- | ::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 |
- | % | 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 |
- +-----------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+---------+
- 4 rows in set (0.00 sec)
- MariaDB [mysql]> \h
- General information about MariaDB can be found at
- http://mariadb.org
- List of all MySQL commands:
- Note that all text commands must be first on line and end with ';'
- ? (\?) Synonym for `help'.
- clear (\c) Clear the current input statement.
- connect (\r) Reconnect to the server. Optional arguments are db and host.
- delimiter (\d) Set statement delimiter.
- edit (\e) Edit command with $EDITOR.
- ego (\G) Send command to mysql server, display result vertically.
- exit (\q) Exit mysql. Same as quit.
- go (\g) Send command to mysql server.
- help (\h) Display this help.
- nopager (\n) Disable pager, print to stdout.
- notee (\t) Don't write into outfile.
- pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
- print (\p) Print current command.
- prompt (\R) Change your mysql prompt.
- quit (\q) Quit mysql.
- rehash (\#) Rebuild completion hash.
- source (\.) Execute an SQL script file. Takes a file name as an argument.
- status (\s) Get status information from the server.
- system (\!) Execute a system shell command.
- tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
- use (\u) Use another database. Takes database name as argument.
- charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
- warnings (\W) Show warnings after every statement.
- nowarning (\w) Don't show warnings after every statement.
- For server side help, type 'help contents'
- MariaDB [mysql]> use performance_schema
- Reading table information for completion of table and column names
- You can turn off this feature to get a quicker startup with -A
- Database changed
- MariaDB [performance_schema]> select * from user
- -> ;
- ERROR 1146 (42S02): Table 'performance_schema.user' doesn't exist
- MariaDB [performance_schema]> select host, user from user;
- ERROR 1146 (42S02): Table 'performance_schema.user' doesn't exist
- MariaDB [performance_schema]> select host, user from mysql.user;
- +-----------+-------+
- | host | user |
- +-----------+-------+
- | % | admin |
- | 127.0.0.1 | root |
- | ::1 | root |
- | localhost | root |
- +-----------+-------+
- 4 rows in set (0.00 sec)
- MariaDB [performance_schema]> use mysql
- Reading table information for completion of table and column names
- You can turn off this feature to get a quicker startup with -A
- Database changed
- MariaDB [mysql]> select * FROM mysql.db;
- Empty set (0.00 sec)
- MariaDB [mysql]> Ctrl-C -- exit!
- Aborted
- student@linux:~> mysql -u admin -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 12
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> exit
- Bye
- student@linux:~> mysql -u root -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 13
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> exit
- Bye
- student@linux:~> mysql -u admin -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 14
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> select version();
- +-----------------+
- | version() |
- +-----------------+
- | 10.0.31-MariaDB |
- +-----------------+
- 1 row in set (0.00 sec)
- MariaDB [(none)]> desc mysqd.db;
- ERROR 1146 (42S02): Table 'mysqd.db' doesn't exist
- MariaDB [(none)]> desc db;
- ERROR 1046 (3D000): No database selected
- MariaDB [(none)]> desc db
- -> mysql -u admin -p
- -> admin
- -> Ctrl-C -- exit!
- Aborted
- student@linux:~> mysql -u admin -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 15
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> use mysql;
- Reading table information for completion of table and column names
- You can turn off this feature to get a quicker startup with -A
- Database changed
- MariaDB [mysql]> desc db;
- +-----------------------+---------------+------+-----+---------+-------+
- | Field | Type | Null | Key | Default | Extra |
- +-----------------------+---------------+------+-----+---------+-------+
- | Host | char(60) | NO | PRI | | |
- | Db | char(64) | NO | PRI | | |
- | User | char(80) | NO | PRI | | |
- | Select_priv | enum('N','Y') | NO | | N | |
- | Insert_priv | enum('N','Y') | NO | | N | |
- | Update_priv | enum('N','Y') | NO | | N | |
- | Delete_priv | enum('N','Y') | NO | | N | |
- | Create_priv | enum('N','Y') | NO | | N | |
- | Drop_priv | enum('N','Y') | NO | | N | |
- | Grant_priv | enum('N','Y') | NO | | N | |
- | References_priv | enum('N','Y') | NO | | N | |
- | Index_priv | enum('N','Y') | NO | | N | |
- | Alter_priv | enum('N','Y') | NO | | N | |
- | Create_tmp_table_priv | enum('N','Y') | NO | | N | |
- | Lock_tables_priv | enum('N','Y') | NO | | N | |
- | Create_view_priv | enum('N','Y') | NO | | N | |
- | Show_view_priv | enum('N','Y') | NO | | N | |
- | Create_routine_priv | enum('N','Y') | NO | | N | |
- | Alter_routine_priv | enum('N','Y') | NO | | N | |
- | Execute_priv | enum('N','Y') | NO | | N | |
- | Event_priv | enum('N','Y') | NO | | N | |
- | Trigger_priv | enum('N','Y') | NO | | N | |
- +-----------------------+---------------+------+-----+---------+-------+
- 22 rows in set (0.00 sec)
- MariaDB [mysql]> grant all on *.* to adminek1;
- Query OK, 0 rows affected (0.01 sec)
- MariaDB [mysql]> show grants for adminek1;
- +-----------------------------------------------+
- | Grants for adminek1@% |
- +-----------------------------------------------+
- | GRANT ALL PRIVILEGES ON *.* TO 'adminek1'@'%' |
- +-----------------------------------------------+
- 1 row in set (0.00 sec)
- MariaDB [mysql]> SELECT user from mysql.user;
- +----------+
- | user |
- +----------+
- | admin |
- | adminek1 |
- | root |
- | root |
- | root |
- +----------+
- 5 rows in set (0.00 sec)
- MariaDB [mysql]> mysql -u adminek1 -p
- -> show grants;
- 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
- show grants' at line 1
- MariaDB [mysql]> mysql -u adminek1 -p
- -> exit
- -> Bye
- student@linux:~> use mysql
- If 'use' is not a typo you can use command-not-found to lookup the package that contains it, like this:
- cnf use
- student@linux:~> mysql -u admin -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 16
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> grant all on *.* to adminek2 identified pass;
- 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
- MariaDB [(none)]> grant all on *.* to adminek2 identified by pass;
- 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
- MariaDB [(none)]> grant all on *.* to adminek2 identified by 'pass';
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> grant all on *.* to 'adminek2'@'localhost' identified by 'pass';
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> show grants adminek2;
- 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
- MariaDB [(none)]> show grants adminek2@localhost;
- 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
- MariaDB [(none)]> show grants for adminek2@localhost;
- +--------------------------------------------------------------------------------------------------------------------------+
- | Grants for adminek2@localhost |
- +--------------------------------------------------------------------------------------------------------------------------+
- | GRANT ALL PRIVILEGES ON *.* TO 'adminek2'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7' |
- +--------------------------------------------------------------------------------------------------------------------------+
- 1 row in set (0.00 sec)
- MariaDB [(none)]> exit
- Bye
- student@linux:~> mysql -u adminek2 -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 17
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> exit
- Bye
- student@linux:~> mysql -u admin -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 18
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> UPDATE mysql user SET Password=PASSWORD('pass') WHERE user='adminek1';
- ERROR 1046 (3D000): No database selected
- MariaDB [(none)]> UPDATE mysql.user SET Password=PASSWORD('pass') WHERE user='adminek1';
- Query OK, 1 row affected (0.28 sec)
- Rows matched: 1 Changed: 1 Warnings: 0
- MariaDB [(none)]> exit
- Bye
- student@linux:~> mysql -u admin -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 19
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> UPDATE mysql.user SET Password=PASSWORD('pass') WHERE user='adminek1';
- Query OK, 0 rows affected (0.00 sec)
- Rows matched: 1 Changed: 0 Warnings: 0
- MariaDB [(none)]> flush privileges;
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> SET PASSWORD FOR adminek1=PASSWORD('mypass');
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> exit
- Bye
- student@linux:~> mysql -u adminek1 -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 20
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> exit
- Bye
- student@linux:~> mysql -u admin -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 21
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> SELECT user.db FROM mysql.db;
- ERROR 1054 (42S22): Unknown column 'user.db' in 'field list'
- MariaDB [(none)]> SELECT grant ala on ala.* to adminek1;
- 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
- MariaDB [(none)]> SELECT grant all on ala.* to adminek1
- -> SELECT grant all on ala.* to adminek1;
- 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
- SELECT grant all on ala.* to adminek1' at line 1
- MariaDB [(none)]> all privileges ala
- -> mysql db
- -> ;
- 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
- MariaDB [(none)]> select user.db FROM mysql.db
- -> ;
- ERROR 1054 (42S22): Unknown column 'user.db' in 'field list'
- MariaDB [(none)]> all privileges ala mysql.db;
- 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
- MariaDB [(none)]> revoke all on ala.* from adminek1;
- ERROR 1141 (42000): There is no such grant defined for user 'adminek1' on host '%'
- MariaDB [(none)]> exit
- Bye
- student@linux:~> mysql -u adminek1 -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 22
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> revoke all on ala.* from adminek1
- -> ;
- ERROR 1044 (42000): Access denied for user 'adminek1'@'%' to database 'ala'
- MariaDB [(none)]> show db from adminek1
- -> l
- -> ;
- 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
- l' at line 1
- MariaDB [(none)]> show db from adminek1;
- 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
- MariaDB [(none)]> GRANT SELECT,INSERT,UPDATE ON ala.* TO adminek1;
- ERROR 1044 (42000): Access denied for user 'adminek1'@'%' to database 'ala'
- MariaDB [(none)]> select * from mysql.user;
- +-----------+----------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+---------+
- | 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 |
- +-----------+----------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+---------+
- | 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 |
- | 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 |
- | ::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 |
- | % | 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 |
- | % | 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 |
- | % | 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 |
- | 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 |
- +-----------+----------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+---------+
- 7 rows in set (0.00 sec)
- MariaDB [(none)]> Ctrl-C -- exit!
- Aborted
- student@linux:~> mysql -u admin -p
- Enter password:
- ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)
- student@linux:~> mysql -u admin -p
- Enter password:
- ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)
- student@linux:~> mysql -u admin -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 25
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> DELETE FROM mysql.user WHERE User='adminek1';
- Query OK, 1 row affected (0.00 sec)
- MariaDB [(none)]> FLUSH PRIVILEGES
- -> ;
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> select user from mysql.user;
- +----------+
- | user |
- +----------+
- | admin |
- | adminek2 |
- | root |
- | root |
- | adminek2 |
- | root |
- +----------+
- 6 rows in set (0.00 sec)
- MariaDB [(none)]> DELETE FROM mysql.user WHERE User='adminek2@localhost';
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> FLUSH PRIVILEGES
- -> ;
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> select user from mysql.user;
- +----------+
- | user |
- +----------+
- | admin |
- | adminek2 |
- | root |
- | root |
- | adminek2 |
- | root |
- +----------+
- 6 rows in set (0.00 sec)
- MariaDB [(none)]> DELETE FROM mysql.db WHERE User='adminek1';
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> FLUSH PRIVILEGES
- -> ;
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> select user from mysql.user;
- +----------+
- | user |
- +----------+
- | admin |
- | adminek2 |
- | root |
- | root |
- | adminek2 |
- | root |
- +----------+
- 6 rows in set (0.00 sec)
- MariaDB [(none)]> DELETE FROM mysql.db WHERE User='adminek2';
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> FLUSH PRIVILEGES
- -> ;
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> select user from mysql.user;
- +----------+
- | user |
- +----------+
- | admin |
- | adminek2 |
- | root |
- | root |
- | adminek2 |
- | root |
- +----------+
- 6 rows in set (0.00 sec)
- MariaDB [(none)]> select user from mysql.db;
- Empty set (0.00 sec)
- MariaDB [(none)]> select user from mysql.admin;
- ERROR 1146 (42S02): Table 'mysql.admin' doesn't exist
- MariaDB [(none)]> select user from mysql.user;
- +----------+
- | user |
- +----------+
- | admin |
- | adminek2 |
- | root |
- | root |
- | adminek2 |
- | root |
- +----------+
- 6 rows in set (0.00 sec)
- MariaDB [(none)]> grant all on *.* to stud1 identified by 'hw1';
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> FLUSH PRIVILEGES;
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> exit
- Bye
- student@linux:~> mysql -u stud1 -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 26
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> exit
- Bye
- student@linux:~> mysql -u admin -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 27
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> grant all on hw1.* to stud1 identified by 'hw1';
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> FLUSH PRIVILEGES
- -> ;
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> show grants for stud1;
- +---------------------------------------------------------------------------------------------------------------+
- | Grants for stud1@% |
- +---------------------------------------------------------------------------------------------------------------+
- | GRANT ALL PRIVILEGES ON *.* TO 'stud1'@'%' IDENTIFIED BY PASSWORD '*E742D6D0D131BE247A6042FEE41F4639E3732765' |
- | GRANT ALL PRIVILEGES ON `hw1`.* TO 'stud1'@'%' |
- +---------------------------------------------------------------------------------------------------------------+
- 2 rows in set (0.00 sec)
- MariaDB [(none)]> revoke all on *.* from stud1;
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> flush privileges
- -> ;
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> show grants for stud1;
- +------------------------------------------------------------------------------------------------------+
- | Grants for stud1@% |
- +------------------------------------------------------------------------------------------------------+
- | GRANT USAGE ON *.* TO 'stud1'@'%' IDENTIFIED BY PASSWORD '*E742D6D0D131BE247A6042FEE41F4639E3732765' |
- | GRANT ALL PRIVILEGES ON `hw1`.* TO 'stud1'@'%' |
- +------------------------------------------------------------------------------------------------------+
- 2 rows in set (0.00 sec)
- MariaDB [(none)]> exit
- Bye
- student@linux:~> mysql -u stud1 -p
- Enter password:
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 28
- Server version: 10.0.31-MariaDB SLE 12 SP1 package
- Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- MariaDB [(none)]> show grants for stud1
- -> ;
- +------------------------------------------------------------------------------------------------------+
- | Grants for stud1@% |
- +------------------------------------------------------------------------------------------------------+
- | GRANT USAGE ON *.* TO 'stud1'@'%' IDENTIFIED BY PASSWORD '*E742D6D0D131BE247A6042FEE41F4639E3732765' |
- | GRANT ALL PRIVILEGES ON `hw1`.* TO 'stud1'@'%' |
- +------------------------------------------------------------------------------------------------------+
- 2 rows in set (0.00 sec)
- MariaDB [(none)]> CREATE database ala;
- ERROR 1044 (42000): Access denied for user 'stud1'@'%' to database 'ala'
- MariaDB [(none)]> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- +--------------------+
- 1 row in set (0.00 sec)
- MariaDB [(none)]> CREATE database hw1;
- Query OK, 1 row affected (0.00 sec)
- MariaDB [(none)]> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | hw1 |
- | information_schema |
- +--------------------+
- 2 rows in set (0.00 sec)
- MariaDB [(none)]>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement