MariaDB Configuration: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 2: Line 2:


* [[MariaDB]]
* [[MariaDB]]
* [[MySQL Operations]]


=Post-Install=
=Post-Install=
==Start at Boot==


<pre>
<pre>
mysql_secure_installation
systemctl enable mariadb.service
systemctl start mariadb.service
</pre>
</pre>


<pre>
==Secure==
Enter current password for root (enter for none):
...
Set root password? [Y/n] Y
...
Remove anonymous users? [Y/n] Y
...
Disallow root login remotely? [Y/n] Y
...
Remove test database and access to it? [Y/n] Y
...
Reload privilege tables now? [Y/n] Y
...
</pre>


=Start at Boot=
Make sure the database is started.


<pre>
For MariaDB 10 and newer (the old name of the tool is <code>mysql_secure_installation</code>):
systemctl enable mariadb
<syntaxhighlight lang='bash'>
systemctl start mariadb
/usr/bin/mariadb-secure-installation
</pre>
</syntaxhighlight>


 
<font size=-2>
<pre>
  NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
 
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
   
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: To do so, start the server, then issue the following commands:
[...]
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: '/usr/bin/mysqladmin' -u root password 'new-password'
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: '/usr/bin/mysqladmin' -u root -h now510.local password 'new-password'
Enter current password for root (enter for none): <enter>
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: Alternatively you can run:
OK, successfully used password, moving on...
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: '/usr/bin/mysql_secure_installation'
   
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: which will also give you the option of removing the test
  [...]
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: databases and anonymous user created by default. This is
   
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: strongly recommended for production servers.
  Switch to unix_socket authentication [Y/n] n
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: See the MariaDB Knowledgebase at http://mariadb.com/kb or the
  ... skipping.
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: MySQL manual for more instructions.
   
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: You can start the MariaDB daemon with:
  [...]
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: cd '/usr' ; /usr/bin/mysqld_safe --datadir='/var/lib/mysql'
   
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: You can test the MariaDB daemon with mysql-test-run.pl
  Change the root password? [Y/n] Y
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: cd '/usr/mysql-test' ; perl mysql-test-run.pl
  New password:
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: Please report any problems at http://mariadb.org/jira
  Re-enter new password:
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: The latest information about MariaDB is available at http://mariadb.org/.
  Password updated successfully!
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: You can find additional information about the MySQL part at:
  Reloading privilege tables..
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: http://dev.mysql.com
   
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: Support MariaDB development by buying support/new features from MariaDB
[...]
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: Corporation Ab. You can contact us about this at sales@mariadb.com.
   
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: Alternatively consider joining our community based development effort:
Remove anonymous users? [Y/n] Y
Jan 6 19:37:13 now510 mariadb-prepare-db-dir: http://mariadb.com/kb/en/contributing-to-the-mariadb-project/
 
[...]
</pre>
Disallow root login remotely? [Y/n] Y
   
[...]
   
  Remove test database and access to it? [Y/n] Y
[...]
   
Reload privilege tables now? [Y/n] Y
  [...]
   
  All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
</font>

Latest revision as of 01:51, 1 January 2024

Internal

Post-Install

Start at Boot

systemctl enable mariadb.service
systemctl start mariadb.service

Secure

Make sure the database is started.

For MariaDB 10 and newer (the old name of the tool is mysql_secure_installation):

/usr/bin/mariadb-secure-installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

[...]

Enter current password for root (enter for none): <enter>
OK, successfully used password, moving on...

[...]

Switch to unix_socket authentication [Y/n] n
 ... skipping.

[...]

Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..

[...]

Remove anonymous users? [Y/n] Y

[...]

Disallow root login remotely? [Y/n] Y

[...]

Remove test database and access to it? [Y/n] Y

[...]

Reload privilege tables now? [Y/n] Y

[...]

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.