// <ahref="./index.html">Document Index</a></div><h1id="sql-mark-existing-mail-user-as-global-domain-admin">SQL: Mark existing mail user as global domain admin</h1>
<h3id="mark-user-as-global-domain-admin-with-sql-command-line-tool">Mark user as global domain admin with SQL command line tool</h3>
<blockquote>
<p>If you don't have any mail account, please follow this tutorial to create a
new mail user: <ahref="./sql.bulk.create.mail.users.html">SQL: Bulk create mail users</a>.</p>
</blockquote>
<p>Let's say you want to mark existing user <code>user@mydomain.com</code> as global domain
admin, please follow steps below to achieve this.</p>
<ul>
<li>
<p>Login to SQL server as either SQL root user or <code>vmailadmin</code> user.</p>
<ul>
<li>
<p>About SQL root user:</p>
<ul>
<li>for MySQL or MariaDB: SQL root user is <code>root</code>.</li>
<li>for PostgreSQL: it's system account <code>postgres</code> on Linux, or
<code>postgresql</code> on FreeBSD, or <code>_pgsql</code> on OpenBSD.</li>
</ul>
</li>
<li>
<p>You can find their passwords in file <code>iRedMail.tips</code> under iRedMail
installation directory. for example, <code>/root/iRedMail-0.9.3/iRedMail.tips</code>.</p>
</li>
</ul>
</li>
<li>
<p>Update SQL table <code>vmail.mailbox</code> and <code>vmail.domain_admins</code> to mark this user
as global domain admin:</p>
</li>
</ul>
<pre><code>sql> UPDATE mailbox SET isadmin=1,isglobaladmin=1 WHERE username='user@mydomain.com';
sql> INSERT INTO domain_admins (username, domain) VALUES ('user@mydomain.com', 'ALL');
</code></pre>
<p>Now you can login to iRedAdmin-Pro as <code>user@mydomain.com</code>, it's global domain
admin.</p><pstyle="text-align: center; color: grey;">All documents are available in <ahref="https://bitbucket.org/zhb/iredmail-docs/src">BitBucket repository</a>, and published under <ahref="http://creativecommons.org/licenses/by-nd/3.0/us/"target="_blank">Creative Commons</a> license. If you found something wrong, please do <ahref="http://www.iredmail.org/contact.html">contact us</a> to fix it.<script>