Install MySQL database on CentOS7.
To install MySQL database on CentOS 7, follow the steps below:
- Open the terminal and log in with the root user.
- Run the following command to update the system software packages:
- update the system with yum
- Run the following command to install the MySQL database server:
- install the mysql-server package using yum
- Start the MySQL service after installation is complete.
- Start the mysqld service using systemctl.
- Run the following command to set up the MySQL service to automatically start on system boot:
- Enable the mysqld service using systemctl.
- Execute the following command to enhance the security of your MySQL database:
- Make MySQL installation more secure
- This command will prompt you to set a password for the root user and provide other security options such as removing anonymous users and disabling remote root login.
- After completing the security setup, you can use the following command to check the status of the MySQL service:
- Check the status of the MySQL service.
You have now successfully installed and configured the MySQL database server. You can log in to the MySQL database using the following command:
mysql -u root -p
Afterward, you can log in by entering the root user password that was set before.