I am trying to updated the my.cnf file to increase the buffer pool size for a query I am running in python via mysql because I keep getting the error:
OperationalError: 2013 (HY000): Lost connection to MySQL server during query
Now I have located the file and get:
/opt/homebrew/etc/my.cnf
/opt/homebrew/Cellar/mysql/8.0.30/.bottle/etc/my.cnf
Now I am trying to figure out how update this file. I have read using sudo command then enter the password, which I do but I get command not found. I am assuming I am doing this wrong.
sudo: /opt/homebrew/etc/my.cnf: command not found
Any and all help will be much appreciated.
After attempting to do the nano command my screen gives me this. So leads me to believe that this is not where the file is.
This is what is seen when doing this command:
sudo /opt/homebrew/etc/my.cnf
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1
Change the my.cnf file as follows:
Launch a terminal and go to the directory containing the my.cnf file. In your instance, it's at
/opt/homebrew/etc/my.cnfor/opt/homebrew/Cellar/mysql/8.0.30/.bottle/etc/my.cnf.To open the file with the nano text editor, use
sudo nano my.cnf. If you are log in as sudo try to usenano my.cnfwithout sudo.After opening the file, go to the [mysqld] section and add the following line:
value innodb buffer pool size(replace value with the desired buffer pool size in bytes)To save the modifications, use Ctrl + O, and to quit nano, press Ctrl + X.
To make the modifications take effect, restart the MySQL server. Depending on your system, you may do this by typing'sudo service mysql restart' or'sudo systemctl restart mysql'.
If you do not want to use nano, you can use any text editor of your choice.