In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
File permission refers to the ability to read and write files to the system. Only with file permission can you execute select.. into outfile and load data infile... Operation, but do not grant file, process, super permissions to accounts other than the administrator, which has serious security risks. Here's a simple experiment:
1. Create the environment mysql > CREATE USER 'filetest'@'localhost' IDENTIFIED BY' mypass'; Query OK, 0 rows affected (0.01 sec)
Mysql > GRANT select ON test.* TO 'filetest'@'localhost'; ERROR 1290 (HY000): The MySQL server is running with the-- skip-grant-tables option so it cannot execute this statement
Mysql > flush privileges; Query OK, 0 rows affected (0.00 sec)
Mysql > GRANT select ON test.* TO 'filetest'@'localhost'; Query OK, 0 rows affected (0.00 sec)
Mysql > CREATE TABLE tab1 (- > aa varchar (50),-> bb varchar (50)->); Query OK, 0 rows affected (0.02 sec)
Mysql > mysql > insert into tab1 values ('aaa','bbb'); Query OK, 1 row affected (0.01 sec)
Mysql > insert into tab1 values ('ccc','ddd'); Query OK, 1 row affected (0.01sec)
Mysql >
2. Switch to filetest user: [root@master ~] # mysql-ufiletest-p Enter password: Welcome to the MySQL monitor. Commands end with; or\ g. Your MySQL connection id is 7 Server version: 5.7.13-log Source distribution
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Mysql > use test; 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 mysql > show databases; +-+ | Database | +-+ | information_schema | | test | +-+ 2 rows in set (0.00 sec)
Mysql > select * from tab1 into outfile'/ mysql/mysql57/st_file1'; ERROR 1045 (28000): Access denied for user 'filetest'@'localhost' (using password: YES) does not have file permission.
3. Root login authorization: mysql > grant file on test.* to filetest@localhost; ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES mysql > grant file on *. * to filetest@localhost; Query OK, 0 rows affected (0.01 sec)
Mysql > flush privileges; Query OK, 0 rows affected (0.00 sec)
4. Filetest users log in
Mysql > use test; 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 mysql > select * from tab1 into outfile'/ mysql/mysql57/st_file'; Query OK, 2 rows affected (0.01sec)
Mysql > [root@master mysql57] # cat st_file aaa bbb ccc ddd
5. Import mysql > create table tab2 as select * from tab1; Query OK, 2 rows affected (0.02 sec) Records: 2 Duplicates: 0 Warnings: 0
Mysql > desc tab2-> +-+ | Field | Type | Null | Key | Default | Extra | +-+- + | aa | varchar (50) | YES | | NULL | bb | varchar (50) | YES | | NULL | | +-+-+ 2 rows in set (0.01sec)
Mysql > select * from tab2; +-+ | aa | bb | +-+-+ | aaa | bbb | | ccc | ddd | +-+-+ 2 rows in set (0.00 sec)
Mysql > truncate table tab2; Query OK, 0 rows affected (0.02 sec)
Mysql > select * from tab2; Empty set (0.00 sec)
Mysql > load data infile'/ mysql/mysql57/st_file1' into table tab2; ERROR 1142 (42000): INSERT command denied to user 'filetest'@'localhost' for table' tab2'
# # root login authorization: mysql > grant insert on test.* to filetest@localhost; Query OK, 0 rows affected (0.01 sec)
Mysql > flush privileges; Query OK, 0 rows affected (0.00 sec)
# # re-login: mysql > load data infile'/ mysql/mysql57/st_file1' into table tab2; Query OK, 2 rows affected (0.01 sec) Records: 2 Deleted: 0 Skipped: 0 Warnings: 0
Mysql > select * from tab2; +-+ | aa | bb | +-+-+ | aaa | bbb | | ccc | ddd | +-+-+ 2 rows in set (0.00 sec)
The little experiment has been completed.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.