snipt

Ctrl+h for KB shortcuts

MySQL

create mysql user and database

1
2
3
4
5
CREATE DATABASE my_database;
GRANT ALL PRIVILEGES ON my_database.* 
TO 'my_user'@'localhost'
IDENTIFIED BY 'my_password' 
WITH GRANT OPTION;
https://snipt.net/embed/7d12b7be7b5e54c74315562b5ce2749e/
/raw/7d12b7be7b5e54c74315562b5ce2749e/
7d12b7be7b5e54c74315562b5ce2749e
mysql
MySQL
5
2019-08-25T09:20:18
True
False
False
/api/public/snipt/1/
create-mysql-user
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">CREATE</span> <span class="k">DATABASE</span> <span class="n">my_database</span><span class="p">;</span> </span><span id="L-2"><a name="L-2"></a><span class="k">GRANT</span> <span class="k">ALL</span> <span class="n">PRIVILEGES</span> <span class="k">ON</span> <span class="n">my_database</span><span class="p">.</span><span class="o">*</span> </span><span id="L-3"><a name="L-3"></a><span class="k">TO</span> <span class="s1">&#39;my_user&#39;</span><span class="o">@</span><span class="s1">&#39;localhost&#39;</span> </span><span id="L-4"><a name="L-4"></a><span class="n">IDENTIFIED</span> <span class="k">BY</span> <span class="s1">&#39;my_password&#39;</span> </span><span id="L-5"><a name="L-5"></a><span class="k">WITH</span> <span class="k">GRANT</span> <span class="k">OPTION</span><span class="p">;</span> </span></pre></div> </td></tr></table>
mysql