This article will take you through how to install MySQL 8 on OpenSUSE. MySQL is a relational database management system(RDBMS) based on Structured Query Language(SQL) that is free and open-source under the terms of the GNU General Public License. SQL is a programming language that allows programmers to create, change, and extract data from relational databases, as well as control user access.
How to Install MySQL 8 on OpenSUSE
- Update your packages.
sudo zypper update
- Download MySQL 8 repository to your system.
wget https://dev.mysql.com/get/mysql80-community-release-sl15-4.noarch.rpm
- Then import the downloaded repository.
sudo rpm -ivh mysql80-community-release-sl15-4.noarch.rpm
- Next import the GPG signing key.
sudo rpm --import /etc/RPM-GPG-KEY-mysql
- Refresh your repository to apply changes.
sudo zypper refresh
- Install MySQL 8 using the command below.
sudo zypper install mysql-community-server
Sample output
Loading repository data... Reading installed packages... Resolving package dependencies... The following 6 NEW packages are going to be installed: mysql-community-client mysql-community-client-plugins mysql-community-common mysql-community-icu-data-files mysql-community-libs mysql-community-server 6 new packages to install. Overall download size: 69.3 MiB. Already cached: 0 B. After the operation, additional 529.3 MiB will be used. Continue? [y/n/v/...? shows all options] (y): y Retrieving package mysql-community-client-plugins-8.0.29-1.sl15.x86_64 (1/6), 1.2 MiB ( 13.3 MiB unpacked) Retrieving: mysql-community-client-plugins-8.0.29-1.sl15.[done (392.2 KiB/s)] mysql-community-client-plugins-8.0.29-1.sl15.x86_64.rpm:
- Check the version of MySQL installed.
mysql --version
Sample output
mysql Ver 8.0.29 for Linux on x86_64 (MySQL Community Server - GPL)
- Enable MySQL to start on boot.
sudo systemctl enable mysql
- Start MySQL.
sudo systemctl start mysql
- MySQL should be up and running, check the status using the following command.
sudo systemctl status mysql
Sample output
● mysql.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2022-06-15 17:34:45 EAT; 35s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 5537 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS) Main PID: 5608 (mysqld) Status: "Server is operational" Tasks: 38 (limit: 4589) CGroup: /system.slice/mysql.service └─5608 /usr/sbin/mysqld Jun 15 17:34:32 localhost.localdomain systemd[1]: Starting MySQL Server... Jun 15 17:34:45 localhost.localdomain systemd[1]: Started MySQL Server.
- Secure MySQL 8.
sudo mysql_secure_installation
Sample output
Securing the MySQL server deployment. Enter password for user root: The 'validate_password' component is installed on the server. The subsequent steps will run with the existing configuration of the component. Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : ... skipping. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. All done!
- In case you are locked out while using a blank password simply create a temporary password using the command below.
sudo grep 'temporary password' /var/log/mysql/mysqld.log
- Login to MySQL
sudo mysql -u root -p
Sample output
Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 43 Server version: 8.0.29 MySQL Community Server - GPL Copyright (c) 2000, 2022, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
- That marks the end of our article, congratulations. We have gone through how to install MySQL 8 on OpenSUSE.
Read more MySQL Documentation