BCE-C712 Linux System Administration

0 of 74 lessons complete (0%)

Web Services and Databases

Database Server Installation

You don’t have access to this lesson

Please register or sign in to access the course content.

CentOS 8:

  1. Install MySQL Server:
sudo dnf install mysql-server
  1. Start and enable MySQL:
sudo systemctl start mysqld sudo systemctl enable mysqld
  1. Secure your MySQL installation:
sudo mysql_secure_installation

Follow the on-screen prompts to set a root password, remove anonymous users, disallow root login remotely, remove the test database, and reload the privilege tables.

Ubuntu 20.04:

  1. Install MySQL Server:
sudo apt install mysql-server
  1. Start and enable MySQL:
sudo systemctl start mysql sudo systemctl enable mysql
  1. Secure your MySQL installation:
sudo mysql_secure_installation

Follow the on-screen prompts to set a root password, remove anonymous users, disallow root login remotely, remove the test database, and reload the privilege tables.

Additional Configuration (for both CentOS 8 and Ubuntu 20.04):

  1. Log in to MySQL as the root user:
sudo mysql -u root -p

Enter the root password you set during the secure installation.

  1. Create a new database and user:
CREATE DATABASE your_database_name; CREATE USER 'your_username'@'localhost' IDENTIFIED BY 'your_password'; 
GRANT ALL PRIVILEGES ON your_database_name.* TO 'your_username'@'localhost'; FLUSH PRIVILEGES;

Replace your_database_name, your_username, and your_password with your preferred values.

  1. Exit MySQL:
EXIT;

Now, you should have MySQL installed and configured on your server. Make sure to adjust the firewall settings if necessary to allow MySQL traffic. Additionally, consider implementing additional security measures based on your specific use case. Always refer to the official documentation for the most accurate and up-to-date information.