This page looks best with JavaScript enabled

Basic MySQL Server Installation on Gentoo

 ·  🎃 kr0m

MySQL is a widely used database that enjoys great stability as it has been tested for many years. It also has certain replication features that allow us to set up a decentralized and scalable infrastructure. In this first article, we will cover the necessary steps to have a basic server on Gentoo as well as the initial steps in which the installation will be secured and the default databases will be removed, leaving the service ready for exploitation.

The MySQL ebuild allows us to compile with different use flags. To know the meaning of each one:

emerge gentoolkit
equery uses dev-db/mysql

Indicate which USE flags to use for MySQL:

vi /etc/portage/package.use/mysql

dev-db/mysql USEs

Compile:

emerge -av dev-db/mysql

Assign a root password:

emerge –config =dev-db/mysql-5.1.70

Finish the installation by removing the test table:

/etc/init.d/mysql start
mysql_secure_installation

Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

We are now ready to enter:

mysql -u root -p

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
+--------------------+
2 rows in set (0.00 sec)

It should be noted that if we want to access from the outside, we must bind the service to the IP of the computer:

vi /etc/mysql/my.cnf

#bind-address = 127.0.0.1
bind-address = IP
/etc/init.d/mysql restart

“In upcoming articles, I will explain how to perform basic operations with databases, tables, and more.”

If you liked the article, you can treat me to a RedBull here