• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Install and use mysql on opensuse15.1

  • 00:27 cat /etc/os-release
  • 00:35 zypper install mariadb-server mariadb
  • 00:58 systemctl restart mysql
  • 01:07 systemctl enable mysql
  • 01:17 mysql_secure_installation
  • 01:54 show databases;
  • 02:07 create database test;
  • 02:26 use test
  • 02:30 create table sample(a int, b int, c int);
  • 03:08 insert into sample (a,b,c) values (1,2,3);
  • 03:15 select * from sample;
  • 03:29 mysqldump -u root -p test > /mnt/test.sql
  • 04:01 mysqldump -u root -p --all-databases > /mnt/all-db.sql
  • 04:48 drop database test;
  • 05:17 mysql -u root -p < /mnt/all-db.sql
{{postValue.id}}

Installation and Usage of MySQL On OpenSUSE 15.1

Process

To check the installed version of OS

LinuxHelp:~ # cat /etc/os-release
NAME="openSUSE Leap"
VERSION="15.1 "
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.1"
PRETTY_NAME="openSUSE Leap 15.1"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.1"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"

Use the below command to install mariadb

LinuxHelp:~ # zypper install mariadb-server mariadb
Loading repository data...
Reading installed packages...
'mariadb-server' not found in package names. Trying capabilities.
Resolving package dependencies...

The following 3 NEW packages are going to be installed:
  mariadb mariadb-client mariadb-errormessages

3 new packages to install.
Overall download size: 19.0 MiB. Already cached: 0 B. After the operation, additional 150.4 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving package mariadb-errormessages-10.2.25-lp151.2.6.1.noarch               (1/3), 212.8 KiB (  2.2 MiB unpacked)
Retrieving: mariadb-errormessages-10.2.25-lp151.2.6.1.noarch.rpm ................................................[done]
Retrieving package mariadb-client-10.2.25-lp151.2.6.1.x86_64                      (2/3),   1.0 MiB ( 25.4 MiB unpacked)
Retrieving: mariadb-client-10.2.25-lp151.2.6.1.x86_64.rpm .........................................[done (388.6 KiB/s)]
Retrieving package mariadb-10.2.25-lp151.2.6.1.x86_64                             (3/3),  17.8 MiB (122.7 MiB unpacked)
Retrieving: mariadb-10.2.25-lp151.2.6.1.x86_64.rpm ................................................[done (852.7 KiB/s)]
Checking for file conflicts: ....................................................................................[done]
(1/3) Installing: mariadb-errormessages-10.2.25-lp151.2.6.1.noarch ..............................................[done]
(2/3) Installing: mariadb-client-10.2.25-lp151.2.6.1.x86_64 .....................................................[done]
Additional rpm output:
usermod: no changes


(3/3) Installing: mariadb-10.2.25-lp151.2.6.1.x86_64 ............................................................[done]
Additional rpm output:
usermod: no changes

Restart and Enable the mysql service

LinuxHelp:~ # systemctl restart mysql
LinuxHelp:~ # systemctl enable mysql
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.

Use the following command to begin secure installation

LinuxHelp:~ # mysql_secure_installation


NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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? [Y/n] 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? [Y/n] y
 ... Success!

By default, MariaDB 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? [Y/n] 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? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

To login into mysql

LinuxHelp:~ # mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.2.25-MariaDB SUSE package

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)


MariaDB [(none)]> create database test;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

MariaDB [(none)]> use test
Database changed

MariaDB [test]> create table sample(a int, b int, c int);
Query OK, 0 rows affected (0.06 sec)


MariaDB [test]> insert into sample (a.b.c) values (1,2,3);
ERROR 1136 (21S01): Column count doesn't match value count at row 1

MariaDB [test]> insert into sample (a,b,c) values (1,2,3);
Query OK, 1 row affected (0.00 sec)

MariaDB [test]> select * from sample;
+------+------+------+
| a    | b    | c    |
+------+------+------+
|    1 |    2 |    3 |
+------+------+------+
1 row in set (0.00 sec)


MariaDB [test]> exit
Bye

To create backup for a database

LinuxHelp:~ # mysqldump -u root -p test > /mnt/test.sql
Enter password: 

Navigate to the databse backup location

LinuxHelp:~ # cd /mnt
LinuxHelp:/mnt # ls -la
total 4
drwxr-xr-x 1 root root   16 Nov  4 01:37 .
drwxr-xr-x 1 root root  156 Oct 20 22:05 ..
-rw-r--r-- 1 root root 1869 Nov  4 01:36 test.sql

To create Backup for all databases

LinuxHelp:/mnt # mysqldump -u root -p --all-databases > /mnt/all-db.sql
Enter password: 
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)


MariaDB [(none)]> exit
Bye

Verify the database backup

LinuxHelp:/mnt # ls -la
total 472
drwxr-xr-x 1 root root     36 Nov  4 01:42 .
drwxr-xr-x 1 root root    156 Oct 20 22:05 ..
-rw-r--r-- 1 root root 478264 Nov  4 01:42 all-db.sql
-rw-r--r-- 1 root root   1869 Nov  4 01:36 test.sql

Use the command to restore the Database

LinuxHelp:/mnt # mysql -u root -p < /mnt/all-db.sql
Enter password: 

Login to the MySQL Database

LinuxHelp:/mnt # mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 21
Server version: 10.2.25-MariaDB SUSE package

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

MariaDB [(none)]> exit
Bye


With this,Installation and Usage of MySQL is successful and comes to an end.

Tags:
aiden
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is mysql on OpenSuse?

A

Mysql is an open source relational database management system which is mainly used as server to create and manage user’s databases

Q

How to check the installed version of mysql?

A

To check the the installed version of mysql, use the below method

mysql -u root -p

Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 19
Server version: 10.2.25-MariaDB SUSE package
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
(version is 10.2.25)

Q

How to check mysql version from command line?

A

To check mysql version from commandline
mysql -V

Q

How to restore specific database?

A

To restore the specific database
mysql -u root -p db_name < file.sql

Q

How to restore all-database?

A

mysql -u root -p < file.sql

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luk Van De Looverbosch ?
How to create a root ?

Hello,
How to create root@linuxhelp in Linux Mint 20.1 64-bit ?
Thanks in advance for your reply.
Best regards.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.