MariaDB: Difference between revisions
>Samthecrazyman m Bullted pointed Related Articles and External Links |
>Samthecrazyman Added how to add a new user. |
||
| Line 94: | Line 94: | ||
<li> Now type <code>rcmysql status</code>. You should see that the sever is now running. If it isn't and it says 'failed', there is a problem with what you have typed. You will need to go back through from the beginning, ensuring you have put the <code>#</code> in front of the lines of code shown.</li> | <li> Now type <code>rcmysql status</code>. You should see that the sever is now running. If it isn't and it says 'failed', there is a problem with what you have typed. You will need to go back through from the beginning, ensuring you have put the <code>#</code> in front of the lines of code shown.</li> | ||
</ul></ol> | </ul></ol> | ||
=== Adding a new user to MySQL === | |||
You may need to add a user to MySQL that doesn't need all the permissions of root (for example, to backup MySQL). Here are some instructions to help you set up a read-only user, in this example, to make a read-only backup user. | |||
* Open Konsole. | |||
* If not logged on a root, <code>su</code>. | |||
* Run <code>mysql -u root -p</code> and type your password when requested. | |||
* Type the following, adapting to your needs: <pre>mysql> CREATE USER 'backup'@'localhost' IDENTIFIED BY 'password';</pre> | |||
** Change <code>password</code> to a password of your choice. If using for a cron job later on, keep the password to an alphanumeric one without any special characters. | |||
* To grant it read-only privileges, run the following command: | |||
<pre>mysql> GRANT SELECT, LOCK TABLES ON *.* TO 'backup'@'localhost' IDENTIFIED 'password';</pre> | |||
* To make MySQL take note of the new privileges, restart the MySQL server or run the following command: | |||
<pre>mysql> FLUSH PRIVILEGES</pre> | |||
* You can now exit the MySQL server. | |||
== Related Articles == | == Related Articles == | ||