mysql 起動時にWorld-writable config file '/***/.my.cnf' is ignored というエラーにより起動ができない

mysql 起動時にWorld-writable config file '/***/.my.cnf' is ignored というエラーにより起動ができないトラブルに直面した

$ mysql
mysql: [Warning] World-writable config file '/***/.my.cnf' is ignored.
ERROR 1045 (28000): Access denied for user 'vagrant'@'localhost' (using password: NO)

原因を調査すると、.my.cnfの権限が誤って変更されてしまっていたようだ。

$ ll /***/.my.cnf
-rwxrwxrwx 1 stack stack 52 Jan 13 06:23 /opt/stack/.my.cnf*

権限を元の644 に戻すと、起動を行うことができた。

$ chmod 644 /***/.my.cnf
$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8063
Server version: 5.7.32-0ubuntu0.18.04.1 (Ubuntu)

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> 

/***/.my.cnfについては、権限が変更できないように固定化できればいいなと思った。