secure_file_priv 配置項對數據導入導出的影響mysql
一、限制mysqld 不容許導入 | 導出web
mysqld --secure_file_prive=null
MySQL [ztjy]> select * from info_posts limit 10 into outfile '/usr/local/src/info_posts_tmp.txt'; ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement.
二、限制mysqld 的導入 | 導出 只能發生在/tmp/目錄下sql
mysqld --secure_file_priv=/tmp/
三、不對mysqld 的導入 | 導出作限制數據庫
cat /etc/my.cnf [mysqld] secure_file_priv
說明:
例如咱們能夠經過 select * from tempdb.t into outfile '/home/mysql/t.txt'; 把tempdb.t 表的數據導出來;這個導出操做能夠面臨以下問題
一、任何一個mysql用戶只要它能執行上面的sql語句、而且執行成功;那麼它就把文件寫到了/home/mysql/目錄下?
若是有一個壞人他一直導出數據到文件目錄,那麼總有一天會被寫滿的!
二、沒有辦法限制只能把文件導出到/tmp/目錄
這個不會影響mysqldump使用,放心好了。服務器
[Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
在5.7中,經過ssl方式鏈接mysql被做爲默認和推薦。若是你並不須要(好比web端和db端同一臺服務器,db服務器處於web端內網等),就能夠不用使用ssl方式。
幹掉警告很簡單,只要在my.cnf聲明跳過ssl就好了。網絡
skip-ssl
如此便OK了。session
2017-09-11T10:31:08.542031Z 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode. 2017-09-11T10:31:08.542053Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode. 2017-09-11T10:31:08.542101Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode. 2017-09-11T10:31:08.543552Z 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode. 2017-09-11T10:31:08.543589Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode. skip-name-resolve
禁止MySQL對外部鏈接進行DNS解析,使用這一選項能夠消除MySQL進行DNS解析的時間。但須要注意,若是開啓該選項, 則全部遠程主機鏈接受權都要使用IP地址方式,不然MySQL將沒法正常處理鏈接請求。wordpress
若是必定要使用參數,這個真心無解,在5.6中壓根不會報localhost的錯。
若是你不喜歡這個提示,只能說,不要使用skip-name-resolve參數。
還要即使你有心去把localhost修改成127.0.0.1,不少應用,好比wordpress這些默認訪問localhost的應用,都會不可用,須要更改host爲127.0.0.1才行。post
要是你沒有遠程訪問數據庫的話,只是在本地使用數據庫,推薦你用skip-networking而不是skip-name-resolve。skip-name-resolve參數它的功能主要是禁用DNS解析的,這樣能夠加快數據庫的反應時間,而skip-networking參數是設置MySQL不要監聽網絡,也就只能本機訪問。this
MySQL [mysql]> select * from db where host='localhost'\G MySQL [mysql]> select * from proxies_priv where host='localhost'\G MySQL [mysql]> select * from tables_priv where host='localhost'\G
以上3個語句能夠查看到上面的幾個用戶
[Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of ta bles using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to s kip this check. 2017-09-13T15:30:05.665352+08:00 0 [Note] Beginning of list of non-natively partitioned tables 2017-09-13T15:30:05.863507+08:00 0 [Note] End of list of non-natively partitioned tables
修改配置my.cnf文件,加上
disable-partition-engine-check=1
啓動的時候會進行check表,可能會拖慢啓動的速度