mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
Updated MySQL tips (markdown)
parent
9c2f4bb91f
commit
9249dfc02c
1 changed files with 22 additions and 0 deletions
|
|
@ -99,3 +99,25 @@ This tips were prepared for [[Install Tracks 2.5 on Ubuntu 20.10]]
|
|||
<blockquote>
|
||||
<p>>mysql -u daniel -p tempe < ~/tracks.sql</p>
|
||||
</blockquote>
|
||||
<h3>Assign privileges for a user on a database</h3>
|
||||
<p>These are examples on how to grant some privileges</p>
|
||||
<blockquote>
|
||||
|
||||
mysql> GRANT USAGE ON *.* TO <em> <strong>thisuser/strong> </em>@localhost;<br/>
|
||||
mysql> GRANT ALL PRIVILEGES ON <em> <strong>thisdb</strong> </em>.* TO <em> <strong>thisuser/strong> </em>@localhost;<br/>
|
||||
mysql> GRANT GRANT OPTION ON <em> <strong>thisdb</strong> </em>.* TO <em> <strong>thisuser/strong> </em>@localhost; # Enables you to grant to or revoke from other users those privileges that you yourself possess.<br/>
|
||||
mysql>quit;
|
||||
</blockquote>
|
||||
<p>Note: for the dump of the database (using mysqldump) you need to add the <strong>global</strong> PROCESS privilege to the user running the command</p>
|
||||
<blockquote>
|
||||
mysql>GRANT PROCESS ON *.* TO <em> <strong>thisuser/strong> </em>@localhost;
|
||||
</blockquote>
|
||||
<p>
|
||||
<br/>
|
||||
</p>
|
||||
<p>Show privileges granted to the current MySQL user</p>
|
||||
<blockquote>mysql> SHOW GRANTS;</blockquote>
|
||||
<p>Show privileges granted to the MySQL user (if you don’t specify a host for the user name, MySQL assumes % as the host):</p>
|
||||
<blockquote>mysql> SHOW GRANTS FOR '<strong>user_name</strong>';</blockquote>
|
||||
<p>Show privileges granted to a particular MySQL user account from a given host:</p>
|
||||
<blockquote>mysql> SHOW GRANTS FOR '<strong>user_name</strong>'@'<strong>host</strong>';</blockquote>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue