/    Sign up×
Community /Pin to ProfileBookmark

How to enable slow query logging

Hi,

Is there a possibility for turning on MySQL slow query logging using PHP, I mean in a shared hosting environment.

Are there any other simpler way to detect slow queries among others…

Thanks and Best Regards

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@dzysyakFeb 10.2009 — MySQL has a feature that allows you to log slow running queries to a file. To enable you just need to add some lines to your my.cnf file, and restart. Add the following:

log-slow-queries = /var/log/mysql/mysql-slow.log

long_query_time = 1

The above will log queries taking longer than one second to the specified log file.
Copy linkTweet thisAlerts:
@chazzyFeb 10.2009 — no, it's something controlled by the server. i'd be surprised that a shared host wouldn't enable this by default, as a way of yelling at its users that the queries are too long. what is it you're trying to get from the query log?
×

Success!

Help @GUIR spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...