<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[mysql slow query log]]></title><description><![CDATA[<p dir="auto">Any recommendations on how to enable mysql slow query logging?</p>
<p dir="auto">Before using Cloudron I'd just temporarily elevate the MySQL user's permissions and set the global variables within a SQL query.</p>
<p dir="auto">Is there any way to:</p>
<ol>
<li>Get root access to temporarily elevate the MySQL user's permissions?</li>
<li>Set some variable somewhere? The variables I need to set are <code>slow_query_log</code>, <code>log_queries_not_using_indexes</code> and <code>slow_query_log_file</code></li>
<li>Access the my.cnf?</li>
</ol>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.cloudron.io/topic/6097/mysql-slow-query-log</link><generator>RSS for Node</generator><lastBuildDate>Sun, 15 Nov 2026 17:58:06 GMT</lastBuildDate><atom:link href="https://forum.cloudron.io/topic/6097.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 29 Nov 2021 21:45:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to mysql slow query log on Tue, 11 Jan 2022 06:24:55 GMT]]></title><description><![CDATA[<p dir="auto">(please read warning in above comment before following instructions below).</p>
<p dir="auto">If you want to make config file changes:</p>
<ul>
<li><code>docker exec -ti mysql /bin/bash</code></li>
<li>Edit <code>/run/mysql/my.cnf</code> as needed</li>
<li><code>supervisorctl restart mysql</code></li>
</ul>
<p dir="auto">It is important to note that the changes to config files are not persistent across container restarts and server reboot. In general, we have not envisioned Cloudron as a development environment, but we do have many devs using it as such. So, if there is interest, maybe we need to improve things for such use cases.</p>
]]></description><link>https://forum.cloudron.io/post/41586</link><guid isPermaLink="true">https://forum.cloudron.io/post/41586</guid><dc:creator><![CDATA[girish]]></dc:creator><pubDate>Tue, 11 Jan 2022 06:24:55 GMT</pubDate></item><item><title><![CDATA[Reply to mysql slow query log on Tue, 11 Jan 2022 06:22:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mmolivier" aria-label="Profile: mmolivier">@<bdi>mmolivier</bdi></a> that took forever... Generally, we don't allow the database containers to have debugging values, it makes it hard for us to maintain arbitrary configs on selfhosted servers.</p>
<p dir="auto">With that warning out of the way, here is how to do it. The <code>mysql</code> addon is a container of it's own. The root password is in the environment variable of the container.</p>
<ul>
<li><code>docker inspect mysql | grep ROOT_PASSWORD</code> . Note down the password</li>
<li><code>docker exec -ti mysql /bin/bash</code> to get a shell into the mysql container.</li>
<li>Inside, the container:</li>
</ul>
<pre><code>root@mysql:/# mysql -uroot -pTHE_PASSWORD_NOTED_ABOVE
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 302
Server version: 8.0.27-0ubuntu0.20.04.1 (Ubuntu)
...

mysql&gt; SET GLOBAL slow_query_log = 'ON';
Query OK, 0 rows affected (0.00 sec)
</code></pre>
<p dir="auto">MySQL logs are located inside the container at <code>/tmp/mysqld.err</code></p>
]]></description><link>https://forum.cloudron.io/post/41585</link><guid isPermaLink="true">https://forum.cloudron.io/post/41585</guid><dc:creator><![CDATA[girish]]></dc:creator><pubDate>Tue, 11 Jan 2022 06:22:31 GMT</pubDate></item><item><title><![CDATA[Reply to mysql slow query log on Thu, 02 Dec 2021 06:48:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mmolivier" aria-label="Profile: mmolivier">@<bdi>mmolivier</bdi></a> Let me try this tomorrow and get back.</p>
]]></description><link>https://forum.cloudron.io/post/40032</link><guid isPermaLink="true">https://forum.cloudron.io/post/40032</guid><dc:creator><![CDATA[girish]]></dc:creator><pubDate>Thu, 02 Dec 2021 06:48:25 GMT</pubDate></item><item><title><![CDATA[Reply to mysql slow query log on Tue, 30 Nov 2021 22:09:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/micmc" aria-label="Profile: micmc">@<bdi>micmc</bdi></a> Doesn't work unfortunately:</p>
<blockquote>
<p dir="auto">mysql&gt; SET slow_query_log = 'ON';</p>
<p dir="auto">ERROR 1229 (HY000): Variable 'slow_query_log' is a GLOBAL variable and should be set with SET GLOBAL</p>
</blockquote>
<p dir="auto">...meaning it has to be set as a global variable. Logging a single database isn't possible apparently. The app level user doesn't have access to set global variables:</p>
<blockquote>
<p dir="auto">mysql&gt; SET GLOBAL slow_query_log = 'ON';<br />
ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation</p>
</blockquote>
]]></description><link>https://forum.cloudron.io/post/39973</link><guid isPermaLink="true">https://forum.cloudron.io/post/39973</guid><dc:creator><![CDATA[mmolivier]]></dc:creator><pubDate>Tue, 30 Nov 2021 22:09:50 GMT</pubDate></item><item><title><![CDATA[Reply to mysql slow query log on Tue, 30 Nov 2021 21:02:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mmolivier" aria-label="Profile: mmolivier">@<bdi>mmolivier</bdi></a> said in <a href="/post/39956">mysql slow query log</a>:</p>
<blockquote>
<p dir="auto">Is there any way to get root/admin access to the MySQL CLI? I'd like to try this approach: <a href="https://ma.ttias.be/mysql-slow-query-log-without-restart/" target="_blank" rel="noopener noreferrer nofollow ugc">https://ma.ttias.be/mysql-slow-query-log-without-restart/</a></p>
</blockquote>
<p dir="auto">Actually yes, you need to open terminal of your app and you should able to get access to the MySQL CLI using the following command:</p>
<pre><code>mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE}
</code></pre>
<p dir="auto">Hope that helps.</p>
]]></description><link>https://forum.cloudron.io/post/39972</link><guid isPermaLink="true">https://forum.cloudron.io/post/39972</guid><dc:creator><![CDATA[micmc]]></dc:creator><pubDate>Tue, 30 Nov 2021 21:02:12 GMT</pubDate></item><item><title><![CDATA[Reply to mysql slow query log on Tue, 30 Nov 2021 14:57:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/girish" aria-label="Profile: girish">@<bdi>girish</bdi></a> I tried to modify the variables using this approach but unfortunately MySQL doesn't log anything after doing this. Seems like these variables are overridden at the database level: If I open the 'Variables' section for my app database in Phpmyadmin the logging is disabled.</p>
<p dir="auto">Is there any way to get root/admin access to the MySQL CLI? I'd like to try this approach: <a href="https://ma.ttias.be/mysql-slow-query-log-without-restart/" target="_blank" rel="noopener noreferrer nofollow ugc">https://ma.ttias.be/mysql-slow-query-log-without-restart/</a></p>
<p dir="auto">This approach would be much better because I want to enable logging on a single database, not on all of them.</p>
]]></description><link>https://forum.cloudron.io/post/39956</link><guid isPermaLink="true">https://forum.cloudron.io/post/39956</guid><dc:creator><![CDATA[mmolivier]]></dc:creator><pubDate>Tue, 30 Nov 2021 14:57:21 GMT</pubDate></item><item><title><![CDATA[Reply to mysql slow query log on Tue, 30 Nov 2021 01:10:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/girish" aria-label="Profile: girish">@<bdi>girish</bdi></a> I'll try it out, thanks!</p>
]]></description><link>https://forum.cloudron.io/post/39944</link><guid isPermaLink="true">https://forum.cloudron.io/post/39944</guid><dc:creator><![CDATA[mmolivier]]></dc:creator><pubDate>Tue, 30 Nov 2021 01:10:34 GMT</pubDate></item><item><title><![CDATA[Reply to mysql slow query log on Tue, 30 Nov 2021 01:01:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mmolivier" aria-label="Profile: mmolivier">@<bdi>mmolivier</bdi></a> The second option is possible with something like below:</p>
<ul>
<li><code>docker exec -ti mysql /bin/bash</code></li>
<li>You can then edit <code>/run/mysql/my.cnf</code></li>
<li><code>supervisorctl restart mysql</code></li>
</ul>
<p dir="auto">Note that the changes will be lost when we update the mysql container (happens when we make a new Cloudron release).</p>
]]></description><link>https://forum.cloudron.io/post/39943</link><guid isPermaLink="true">https://forum.cloudron.io/post/39943</guid><dc:creator><![CDATA[girish]]></dc:creator><pubDate>Tue, 30 Nov 2021 01:01:02 GMT</pubDate></item></channel></rss>