Projects
How To Install MySQL 8 on Amazon Linux 2
- 1. Configure Yum Repository
- 2. Configure Yum Repository
- 3. Activate and Start MySQL Service\
- 4.Find initial root password
- 5. MySQL Post Installation Setup
- 6. Connect to MySQL
Step 1 – Configure Yum Repository :
Most of the packages required the dependencies that are available in other third-party repositories.
Use the following command to configure the EPEL repository that is required for package installation.
sudo amazon-linux-extras install epel -y |
What is EPEL ? |
Extra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS, Scientific Linux (SL), Oracle Linux (OL), AlmaLinux (AL) and Rocky Linux (RL).Versions are available in EPEL?EPEL 9: x86_64, s390x, ppc64le, aarch64, sourcesEPEL 8: x86_64, s390x, ppc64le, aarch64, sourcesEPEL 7: x86_64, ppc64le, sources (EPEL-7 for aarch64 is no longer supported as Red Hat ended support for this architecture).For more information visit : https://docs.fedoraproject.org/en-US/epel/ |
Then configure the MySQL repository by installing the package provided by the MySQL official site.
sudo yum install https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm |
Step 2 – Install MySQL Server :
Execute the below-mentioned command to install MySQL 8 community server on Amazon Linux.
sudo yum install mysql-community-server |
Step 3 – Activate and Start MySQL Server :
To auto-start on system startup, then start it manually for the first time.
sudo systemctl enable mysqld | |
sudo systemctl start mysqld | |
sudo systemctl status mysqld |
Step 4 – Find initial root password : h<eK63AwZcR6
cat /var/log/mysqld.log | grep “A temporary password” |
Step 5 – MySQL Post Installation Setup :
Run the below command to successfully setup mysql account
sudo mysql_secure_installation |
Add the configuration as per your choices
-
- Enter password for user root: [Enter current root password]
-
- New password: [Enter a new root password]
-
- Re-enter new password: [Re-Enter the new root password]
-
- Estimated strength of the password: 100
-
- Change the password for root ? ((Press y|Y for Yes, any other key for No) : n
-
- Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
-
- Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
-
- Remove the test database and access to it? (Press y|Y for Yes, any other key for No) : y
-
- Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
-
- All done!
Step 6 – Connect to Mysql :
Run the below command to connect to the MySQL command line interface. It will prompt for the root account password. On successful authentication, you will get the MySQL prompt.
mysql -u root -p |
Playing with mysql : Creating database with test100 name , verifying the database creation by listing databases