MySQL 報錯'Variable 'XXX' is a read only variable'

feelpurple發表於2017-03-13
設定引數時報錯
mysql> set global secure_file_priv='/database/percona';
ERROR 1238 (HY000): Variable 'secure_file_priv' is a read only variable

報錯原因:
引數為只讀引數,需要在配置檔案中更改該引數,之後重啟資料庫

[mysql@localhost percona]$ bin/mysqladmin -uroot -S /u01/mysql_data/mysql.sock shutdown -p
Enter password:
2017-03-13T10:38:21.340514Z mysqld_safe mysqld from pid file /u01/mysql_data/localhost.localdomain.pid ended
[1]+  Done                    bin/mysqld_safe --defaults-file=/u01/mysql_data/my.cnf
[mysql@localhost percona]$ vim /u01/mysql_data/my.cnf
[mysqld]
secure_file_priv='/database/percona'

[mysql@localhost percona]$ bin/mysqld_safe --defaults-file=/u01/mysql_data/my.cnf &
[1] 28543
[mysql@localhost percona]$  mysqld_safe Adding '/database/percona/lib/mysql/libjemalloc.so.1' to LD_PRELOAD for mysqld
2017-03-13T10:46:33.142327Z mysqld_safe Logging to '/u01/mysql_data/mysqld_error.log'.
2017-03-13T10:46:33.143853Z mysqld_safe Logging to '/u01/mysql_data/mysqld_error.log'.
2017-03-13T10:46:33.166624Z mysqld_safe Starting mysqld daemon with databases from /u01/mysql_data

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-2135259/,如需轉載,請註明出處,否則將追究法律責任。

相關文章