i cannot change and how to open /etc/my.cnf

I’m new to laravel I’d like to change utf8 from the others but I don’t know why i was not able to open the file and change. please help.

[mac]$ docker-compose exec mysql bash
[email protected]:/ sudo vi /etc/my.cnf
bash: sudo: command not found 

[email protected]:/  /etc/init.d/mysql restart
 % docker-compose up -d
 % docker-compose exec mysql bash
[email protected]:/ sudo vi /etc/my.cnf

bash: sudo: command not found

docker-compose exec mysql bash
mysql -u root -p
mysql> SHOW VARIABLES LIKE '%char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     |
| character_set_connection | latin1                     |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | latin1                     |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.09 sec)


Answer

You need to add a space between the vi command you are trying execute and the file path you are passing to it.

sudo vi /etc/my.cnf

Leave a Reply

Your email address will not be published. Required fields are marked *