<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Mysql on Details...</title>
    <link>https://www.deepreflect.net/tags/mysql/</link>
    <description>Recent content in Mysql on Details...</description>
    <generator>Hugo</generator>
    <language>en-US</language>
    <copyright>Copyright © 2003 - 2026 Leonardo Rizzi</copyright>
    <lastBuildDate>Tue, 30 Jun 2026 03:28:29 +0200</lastBuildDate>
    <atom:link href="https://www.deepreflect.net/tags/mysql/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>MySQL Change Password</title>
      <link>https://www.deepreflect.net/2009/03/22/mysql-change-password/</link>
      <pubDate>Sun, 22 Mar 2009 23:44:10 +0000</pubDate>
       <guid isPermaLink="false">http://blog.deepreflect.net/?p=411</guid> 
      <description>&lt;p&gt;If you have never set a root password for mysql, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;# mysqladmin -u root password NEWPASSWORD&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;However, if you want to change (or update) a root password, then you need to use following command&lt;/p&gt;
&lt;p&gt;&lt;code&gt;# mysqladmin -u root -p oldpassword newpass&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Enter password:
Change MySQL password for other user
To change a normal user password you need to type (let us assume you would like to change password for leo):&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>If you have never set a root password for mysql, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows:</p>
<p><code># mysqladmin -u root password NEWPASSWORD</code></p>
<p>However, if you want to change (or update) a root password, then you need to use following command</p>
<p><code># mysqladmin -u root -p oldpassword newpass</code></p>
<p>Enter password:
Change MySQL password for other user
To change a normal user password you need to type (let us assume you would like to change password for leo):</p>
<p><code># mysqladmin -u leo -p oldpassword newpass</code></p>
<p>Changing mysql root user password using mysql sql command
This is another method. mysql stores username and passwords in user table inside mysql database. You can directly update password using the following method to update or change password for user leo:</p>
<ol>
<li>Login to mysql server, type following command at shell prompt:</li>
</ol>
<p><code># mysql -u root -p</code></p>
<ol start="2">
<li>Use mysql database (type command at mysqlprompt):</li>
</ol>
<p><code>mysqluse mysql;</code></p>
<ol start="3">
<li>Change password for user leo:</li>
</ol>
<p><code>mysqlupdate user set password=PASSWORD(&quot;NEWPASSWORD&quot;) where User='leo';</code></p>
<ol start="4">
<li>Reload privileges:</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>mysqlflush privileges;
</span></span><span style="display:flex;"><span>mysqlquit
</span></span></code></pre></div>]]></content:encoded>
    </item>
    <item>
      <title>MySQL Backup &amp; Restore</title>
      <link>https://www.deepreflect.net/2008/12/26/mysql-backup-restore/</link>
      <pubDate>Fri, 26 Dec 2008 02:52:03 +0000</pubDate>
       <guid isPermaLink="false">http://blog.deepreflect.net/?p=355</guid> 
      <description>&lt;p&gt;Per effettuare un backup del singolo database:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@tardis:~# `mysqldump --database dbname &amp;gt; name_db.sql -u root -p`
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Queste sono opzioni utili:&lt;/p&gt;
&lt;p&gt;&amp;ndash;quick: effettua il dump direttamente sullo standard output;
&amp;ndash;add-drop-table: inserisce le istruzioni di eliminare le tabelle esistenti prima di ricrearle;
&amp;ndash;add-locks: blocca gli inserimenti;
&amp;ndash;lock-tables: blocca la lettura;&lt;/p&gt;
&lt;p&gt;Per fare un restore del singolo database:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@tardis:~# `mysql --one-database dbname &amp;lt; name_db.sql -u root -p `
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
      <content:encoded><![CDATA[<p>Per effettuare un backup del singolo database:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>root@tardis:~# `mysqldump --database dbname &gt; name_db.sql -u root -p`
</span></span></code></pre></div><p>Queste sono opzioni utili:</p>
<p>&ndash;quick: effettua il dump direttamente sullo standard output;
&ndash;add-drop-table: inserisce le istruzioni di eliminare le tabelle esistenti prima di ricrearle;
&ndash;add-locks: blocca gli inserimenti;
&ndash;lock-tables: blocca la lettura;</p>
<p>Per fare un restore del singolo database:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>root@tardis:~# `mysql --one-database dbname &lt; name_db.sql -u root -p `
</span></span></code></pre></div>]]></content:encoded>
    </item>
    <item>
      <title>MySQL - Reset root password</title>
      <link>https://www.deepreflect.net/2008/11/17/mysql-reset-root-password/</link>
      <pubDate>Mon, 17 Nov 2008 19:43:42 +0000</pubDate>
       <guid isPermaLink="false">http://blog.deepreflect.net/?p=316</guid> 
      <description>&lt;p&gt;E si a volte capita di non ricordare o avere sotto mano la password di un database mysql, ecco qualche breve passaggio per reimpostarla:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Stoppare il server mysql solitamente una cosa del genere dovrebbe bastare:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;code&gt;root@tardis:~# /etc/init.d/mysql stop&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;2`. Avviare una sessione del demone mysql con il parametro &amp;ldquo;skip grant table&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;root@tardis:~# mysqld\_safe --skip-grant-tables&lt;/code&gt;&lt;/p&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;A questo punto è possibile collegarsi al server senza che richieda credenziali quindi:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; root@tardis:~# mysql
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;Reipostiamo direttamente nella tabella del db la password di root:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mysql&amp;gt; UPDATE mysql.user SET Password=PASSWORD(&amp;#39;NewPass&amp;#39;) WHERE User=&amp;#39;root&amp;#39;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mysql&amp;gt; FLUSH PRIVILEGES;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;5&#34;&gt;
&lt;li&gt;Stoppiamo il demone avviato con il &amp;ldquo;skip grant table&amp;rdquo; e riavviare quello corretto:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;code&gt;root@tardis:~# /etc/init.d/mysql start&lt;/code&gt;&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>E si a volte capita di non ricordare o avere sotto mano la password di un database mysql, ecco qualche breve passaggio per reimpostarla:</p>
<ol>
<li>Stoppare il server mysql solitamente una cosa del genere dovrebbe bastare:</li>
</ol>
<p><code>root@tardis:~# /etc/init.d/mysql stop</code></p>
<p>2`. Avviare una sessione del demone mysql con il parametro &ldquo;skip grant table&rdquo;</p>
<p><code>root@tardis:~# mysqld\_safe --skip-grant-tables</code></p>
<ol start="3">
<li>A questo punto è possibile collegarsi al server senza che richieda credenziali quindi:</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span> root@tardis:~# mysql
</span></span><span style="display:flex;"><span> &gt;
</span></span></code></pre></div><ol start="4">
<li>Reipostiamo direttamente nella tabella del db la password di root:</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>mysql&gt; UPDATE mysql.user SET Password=PASSWORD(&#39;NewPass&#39;) WHERE User=&#39;root&#39;;
</span></span><span style="display:flex;"><span>mysql&gt; FLUSH PRIVILEGES;
</span></span></code></pre></div><ol start="5">
<li>Stoppiamo il demone avviato con il &ldquo;skip grant table&rdquo; e riavviare quello corretto:</li>
</ol>
<p><code>root@tardis:~# /etc/init.d/mysql start</code></p>
]]></content:encoded>
    </item>
    <item>
      <title>Debian - debian-sys-maint</title>
      <link>https://www.deepreflect.net/2008/11/12/debian-debian-sys-maint/</link>
      <pubDate>Wed, 12 Nov 2008 20:06:04 +0000</pubDate>
       <guid isPermaLink="false">http://blog.deepreflect.net/?p=278</guid> 
      <description>&lt;p&gt;Se per sbaglio durante un restore di un database mysql cancellaste l&amp;rsquo;utente di sistema debian-sys-maint
Potete ripristinarlo usando la password generata e scritta in chiaro in questo file:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;/etc/mysql/debian.cnf&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Questo è necessario se usate il sitema APT per gestire gli aggiornamenti dei servizi, in caso contrario non ha senso di esistere.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Se per sbaglio durante un restore di un database mysql cancellaste l&rsquo;utente di sistema debian-sys-maint
Potete ripristinarlo usando la password generata e scritta in chiaro in questo file:</p>
<p><code>/etc/mysql/debian.cnf</code></p>
<p>Questo è necessario se usate il sitema APT per gestire gli aggiornamenti dei servizi, in caso contrario non ha senso di esistere.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
