使用MySQL8.0,MySQL 报错Failed to access directory for --secure-file-priv
方法1
- 重建容器
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql --secure-file-priv='/usr/local'
- 进入容器
docker exec
- 进入mysql
root@9abe1dd59947:/# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.20 MySQL Community Server - GPL
Copyright (c) 2000, 2020, 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>
- 查看secure_file_priv属性
mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------------+
| Variable_name | Value |
+------------------+-------------+
| secure_file_priv | /usr/local/ |
+------------------+-------------+
1 row in set (0.01 sec)