Quick Install MySQL 8.0 on Red Hat 9

The steps to install MySQL 8.0 on Red Hat 9 are as follows:

  1. Adding the MySQL repository : First, the official MySQL repository needs to be added to your system. This ensures that you are getting the latest version of MySQL and can receive automatic updates. To add the MySQL repository, open a terminal and download the repository configuration package:

    wget https://repo.mysql.com//mysql80-community-release-el9-1.noarch.rpm
    

    Once the download is complete, install it:

    sudo dnf install mysql80-community-release-el9-1.noarch.rpm
    
  2. Install MySQL 8.0 : Once the repository is added to your system, you can install MySQL 8.0 with the following command:

    sudo dnf install mysql-community-server
    

    After the installation is complete, start the MySQL service with the following command:

    sudo systemctl start mysqld
    
  3. Configure MySQL securely : By default, when you first install MySQL, MySQL is insecure. During the installation process, a temporary password will be set for the root account. You can get the password from the log file with the following command:

    grep 'A temporary password is generated' /var/log/mysqld.log | tail -1
    

    Then you need to run the following command for security setup:

    sudo mysql_secure_installation
    

    You will be prompted to set a root password for MySQL and answer some security questions. Answer these questions according to your preferences.

  4. Test the installation : To test the installation, you can log into the MySQL shell with the following command:

    mysql -u root -p
    

    Enter the root password you set during security and you should be able to access the MySQL shell

Guess you like

Origin blog.csdn.net/u011197085/article/details/131435302