# MySQL

# Mysql Slow Query

vi /etc/my.cnf

slow\_query\_log = 1  
slow-query-log-file = /var/log/mysql-slow.log  
long\_query\_time = 2

touch /var/log/mysql-slow.log

chown mysql:mysql /var/log/mysql-slow.log

systemctl restart mysqld

# Connection Refused MySQL

https://chatgpt.com/share/67b548c2-8cc8-8013-ab45-89a4457eed65

1\. sudo nano /etc/my.cnf  
&gt; ensure bind address = 0.0.0.0   
&gt; sudo systemctl restart mysql

ensure # skip-networking is commented  
ensure #block\_encryption\_mode and check ssl version compatible with the mysql version or not.

2.MySQL may block connections if require\_secure\_transport is enabled but the client isn't using SSL. (usually for staging server KPDN )  
&gt; Update my.cnf file require\_secure\_transport = OFF

# Docker

```  
$ docker run --name test-mysql -e MYSQL\_ROOT\_PASSWORD=strong\_password -d mysql  
```