Let's first see from where to download MySQL 8 and a basic understanding of package structures to choose which one is appropriate. We start by obtaining MySQL 8 and will then quickly glance through installation and verification.
Installing MySQL 8
Obtaining MySQL 8
Download the RPM package of the MySQL Community Server from its download page (https://dev.mysql.com/downloads/mysql/8.0.html). There are various variants available based on the operating system and its architecture version. It comes with different packages that can be described by the package name. The following syntax is followed by the package name:
packageName-version-distribution-archType.rpm
Package Name: Name of the package, like myql-community-server, mysql-community-client, mysql-community-libs
Version: Describes the version-particular package
Distribution: This says the package is intended for which Linux distribution based on its abbreviation
Abbreviation | Linux distribution |
el6, el7 | Red Hat Enterprise Linux/Oracle Linux/CentOS 6, 7 |
fc24, fc25 | Fedora 24 or 25 |
sles12 | SUSE Linux Enterprise Server 12 |
solaris11 | Oracle Solaris 11 |
Â
Arch Type: Describes the processor type for which the package was built, like x86_64, i686, and so on
MySQL 8 installation
Once you have the RPM packages, just install it using the following command. This will place the required files and folder under the system directories:
rpm -vih <package-name>.rpm
For the standard installation, it requires only mysql-community-common, mysql-community-libs, mysql-community-client, and mysql-community-server packages. Look at the following screenshot for the installation process:
After the successful installation, just check its version to validate if it's installed properly and can be accessible:
The next step is to reset the temporary password during post-installation. MySQL will restrict you to use the database before changing this temporary password. A temporary password will be generated by MySQL and available in its log file. To retrieve a temporary password, you need to open the /var/log/mysql/mysqld.log file and search for the temporary password keyword.
Copy this and try to connect to MySQL with the following command:
As shown in the preceding screenshot, you will land on a MySQL command prompt, where you can execute the following query to reset the password:
ALTER USER 'root'@'localhost' IDENTIFIED BY '<NEW_PASSWORD>';
MySQL service commands
Let's look at a few MySQL basic commands:
- To start the MySQL service, perform the following command:
service mysqld start
- To stop the MySQL service, perform the following command:
service mysqld stop
- To check the status of MySQL service whether it is running or not, perform the following command:
service mysqld status