CentOS7 下调教mysql记实 之一
遷移數(shù)據(jù)庫時(shí)遇到錯(cuò)誤:
Error Code: 1418. This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
解釋:
默認(rèn)情況下function的創(chuàng)建是禁止的。
原來是因?yàn)樵谥鲝膹?fù)制的兩臺(tái)MySQL服務(wù)器中開啟了二進(jìn)制日志選項(xiàng)log-bin,slave會(huì)從master復(fù)制數(shù)據(jù),而一些操作,比如function所得的結(jié)果在master和slave上可能不同,所以存在潛在的安全隱患。因此,在默認(rèn)情況下回阻止function的創(chuàng)建。
解決辦法:
在CentOS終端上運(yùn)行:
# mysql -uroot -p你的密碼
MariaDB [(none)]> show variables like '%func%';
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | OFF |
+---------------------------------+-------+
1 row in set (0.00 sec)
MariaDB [(none)]> set global log_bin_trust_function_creators=1;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show variables like '%func%';
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | ON |
+---------------------------------+-------+
1 row in set (0.00 sec)
?
通過?set global log_bin_trust_function_creators=1; 的設(shè)置,在重啟后失效。永久辦法:
windows下my.ini[mysqld]加上log_bin_trust_function_creators=1 linux下/etc/my.cnf下my.cnf
[mysqld]加上log_bin_trust_function_creators=1
?
轉(zhuǎn)載于:https://www.cnblogs.com/dreamfine/p/6881751.html
總結(jié)
以上是生活随笔為你收集整理的CentOS7 下调教mysql记实 之一的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 不跟华为小米竞争!蔚来手机果真不一样:业
- 下一篇: 重装mysql出现无法start ser