WSL2 This is for those who are addicted to finding a solution to permission even if they search with MySQL. (Always link with Docker on Windows ... Do you use GPU!)
When I start the container with docker-compose up -d
, the MySQL container cannot be started like the following.
root@pc-name: docker-compose logs mysql
mysql_1 | mysqld: Cannot change permissions of the file 'private_key.pem' (OS errno 1 - Operation not permitted)
mysql_1 | 2020-09-10T05:04:53.449233Z 0 [ERROR] [MY-010295] [Server] Could not set file permission for private_key.pem
mysql_1 | 2020-09-10T05:04:53.449629Z 0 [ERROR] [MY-010119] [Server] Aborting
I want to describe the countermeasures for this guy ( permission
)
Add mount options to /etc/wsl.conf
.
Mount options to add
[automount]
options = "metadata"
I think that the beginning of WSL2 does not exist basically, so follow the procedure below. Create `` `/etc/wsl.conf``` in the WSL2 distribution.
#Login with root
user@pc-name:sudo -i
#Create a new wsl config file on the wsl distribution
root@pc-name: sudo touch /etc/wsl.conf
#Edit the configuration file.
root@pc-name: vi /etc/wsl.conf
Change mount options. Put the vi command in insert mode with i
and enter the following.
[automount]
options = "metadata"
After pressing ESC, overwrite and save (: wq
) and restart WSL.
#Route logout
root@pc-name:exti
#wsl logout
user@pc-name:exit
#WSL shutdown
wsl --shutdown
#Start WSL + login
wsl
I think that the Permission error has disappeared again due to Docker.
The following log is because the mount directory of / var / lib / mysql already exists. The solution is to delete that directory.
root@pc-name: docker-compose logs mysql
...
mysql_1 | 2020-09-10T05:00:42.590708Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
mysql_1 | 2020-09-10T05:00:42.590714Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
mysql_1 | 2020-09-10T05:00:42.590777Z 0 [ERROR] [MY-010119] [Server] Aborting
Recommended Posts