MariaDB Installation: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=Internal= * MariaDB") |
|||
(27 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
* [[MariaDB]] | * [[MariaDB]] | ||
=Linux= | |||
==Prerequisites== | |||
* The host name should be resolvable with resolveip. | |||
==RHEL 7== | |||
⚠️ After installation, make sure you go through the [[#Post-Install|Post-Install]] steps, described below. | |||
===MariaDB 10 and Newer=== | |||
As root: | |||
<syntaxhighlight lang='bash'> | |||
cd ~/tmp | |||
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | |||
chmod +x mariadb_repo_setup | |||
./mariadb_repo_setup | |||
</syntaxhighlight> | |||
<syntaxhighlight lang='bash'> | |||
yum install -y MariaDB-server | |||
</syntaxhighlight> | |||
<syntaxhighlight lang='bash'> | |||
systemctl enable mariadb.service | |||
systemctl start mariadb.service | |||
</syntaxhighlight> | |||
===MariaDB 5=== | |||
<syntaxhighlight lang='bash'> | |||
yum install -y mariadb-server mariadb | |||
</syntaxhighlight> | |||
==Post-Install== | |||
{{Internal|MariaDB_Configuration#Post-Install|MariaDB Configuration - Post Install}} | |||
==Uninstallation== | |||
Uninstallation with state removal: | |||
<syntaxhighlight lang="bash"> | |||
systemctl stop mariadb.service | |||
systemctl disable mariadb.service | |||
yum remove mariadb-server mariadb | |||
# remove data | |||
rm -r /var/lib/mysql | |||
# remove logs | |||
rm -r /var/log/mariadb | |||
rm -r /var/run/mariadb | |||
</syntaxhighlight> | |||
=Mac= | |||
<syntaxhighlight lang='bash'> | |||
brew install mariadb | |||
</syntaxhighlight> | |||
==Post-Install Configuration== | |||
Immediately after installation, start the database as described in [[#To_Start_at_Boot|To Start at Boot]] and run <code>mysql_secure_installation</code>. | |||
As configured by the initial installation, the script has to be run by root, which authenticates itself using system credential. In consequence, <code> mysql_secure_installation</code> must be used as <code>sudo</code>: | |||
<syntaxhighlight lang='bash'> | |||
sudo /opt/brew/bin/mysql_secure_installation | |||
</syntaxhighlight> | |||
<font size=-2> | |||
[...] | |||
Enter current password for root (enter for none): | |||
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. | |||
</font> | |||
==To Start at Boot== | |||
<syntaxhighlight lang='bash'> | |||
brew services start mariadb | |||
</syntaxhighlight> | |||
==To Start When Needed== | |||
To run on demand: | |||
<syntaxhighlight lang='bash'> | |||
/opt/brew/opt/mariadb/bin/mysqld_safe --datadir\=/opt/brew/var/mysql | |||
</syntaxhighlight> | |||
==Connect== | |||
<syntaxhighlight lang='bash'> | |||
mysql -u root -p | |||
[...] | |||
MariaDB [(none)]> | |||
</syntaxhighlight> |
Latest revision as of 01:45, 1 January 2024
Internal
Linux
Prerequisites
- The host name should be resolvable with resolveip.
RHEL 7
⚠️ After installation, make sure you go through the Post-Install steps, described below.
MariaDB 10 and Newer
As root:
cd ~/tmp
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
chmod +x mariadb_repo_setup
./mariadb_repo_setup
yum install -y MariaDB-server
systemctl enable mariadb.service
systemctl start mariadb.service
MariaDB 5
yum install -y mariadb-server mariadb
Post-Install
Uninstallation
Uninstallation with state removal:
systemctl stop mariadb.service
systemctl disable mariadb.service
yum remove mariadb-server mariadb
# remove data
rm -r /var/lib/mysql
# remove logs
rm -r /var/log/mariadb
rm -r /var/run/mariadb
Mac
brew install mariadb
Post-Install Configuration
Immediately after installation, start the database as described in To Start at Boot and run mysql_secure_installation
.
As configured by the initial installation, the script has to be run by root, which authenticates itself using system credential. In consequence, mysql_secure_installation
must be used as sudo
:
sudo /opt/brew/bin/mysql_secure_installation
[...] Enter current password for root (enter for none): 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.
To Start at Boot
brew services start mariadb
To Start When Needed
To run on demand:
/opt/brew/opt/mariadb/bin/mysqld_safe --datadir\=/opt/brew/var/mysql
Connect
mysql -u root -p
[...]
MariaDB [(none)]>