How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

April 25, 2018

apparmor=”DENIED” operation=”open” profile=”/usr/sbin/mysqld”

Filed under: Linux — Tags: , , — admin @ 12:07 pm

Today try to move the path of mysql to new one , because on ec2 I was left without space.

Well I have stopped the mysqld copy files modity the my.cnf with new datadir but when try to start .. well didn’t started .. After a little dmesg search see that on ubuntu is apparmor .

Try to make alias into file /etc/mysql/mysql.conf.d/mysqld.cnf  but didn’t resolve the problem

Find out that you have to edit also /etc/apparmor.d/usr.sbin.mysqld

and add

/db/data/mysql r

/db/data/mysql** rwk

After this mysqld started with new path.

February 28, 2012

MYSQL slow queries log

Filed under: Linux — Tags: , , — admin @ 5:18 pm

MySQL has built-in functionality that allows you to log SQL queries to a file , You can enable the full SQL queries logs to a file or only slow running queries log. It is easy for us to troubleshoot/ debug the sql statement if SQL queries log enable.
* To enable slow Query Log only
log-slow-queries = /var/log/mysql/mysql-slow.log
long_query_time = 1

The minimum and default values of long_query_time are 1 and 10, respectively.

* To enable full Log Query
log=/var/log/mysqldquery.log
This will log all queries on your mysqld.

Selecting Queries to Optmize
– The slow query log
– Logs all queries that take longer than long_query_time
– Can also log all querie s that don’t use indexes with
–log-queries-not-using-indexes
– To log slow administatve commands use
–log-slow-admin-statements
– To analyze the contents of the slow log use
mysqldumpslow

Powered by WordPress