Cek versi mysql ubuntu

Each version of MySQL adds new features to the database and some old features, and queries will be either removed or deprecated. So when you connect an application, it is important to determine the current MySQL version to make sure that your application is compatible with the database.

There are a couple of ways we can check mysql version in Ubuntu, the easiest and quickest method is to run the mysqladmin command from the terminal with version option:

sudo mysqladmin version

the output will be as follows:

Server version		5.7.24-0ubuntu0.18.04.1
Protocol version	10
Connection		Localhost via UNIX socket
UNIX socket		/var/run/mysqld/mysqld.sock
Uptime:			1 min 7 sec

The Server version number can be read as minor release number 7.23 of the major version 5.

Alternatively, you can log in to the MySQL Console:

sudo mysql

To get the server version, run the SELECT VERSION() statement:

SELECT VERSION();

The output will be the Mysql version on your Ubuntu server as seen in the following screenshot:

Cek versi mysql ubuntu

Linux Shell Script

Now lets create a Linux shell script that output Ubuntu MySQL version. First, create a file called check_version.sh.

#!/bin/bash

MYSQL_VERSION=$(mysql -e "SELECT VERSION()" -sN)
echo $MYSQL_VERSION

Make the program executable, then execute with root privileges:

chmod +x check_version.sh
sudo ./check_version.sh

The output will be:

5.7.23-0ubuntu0.18.04.1

Note that MySQL root user on Ubuntu 18.04 does not have password by default, if you have set root password, then you should provide the password with -p option.

Tutorial singkat ini menunjukkan kepada siswa dan pengguna baru cara memeriksa MySQL | Versi server MariaDB di Ubuntu Linux.

Bagaimana Kamu mengetahui versi server database MySQL atau MariaDB yang Kamu jalankan? Bagaimana Kamu mengetahuinya? Perintah apa yang Kamu gunakan?

Jawaban untuk semua pertanyaan Kamu yang dirinci di bawah ini.

Saat ini, ke mana pun Kamu melihat, Kamu akan menemukan server database MariaDB digunakan dengan banyak proyek sumber terbuka. Ini tidak terjadi beberapa tahun yang lalu.

Kemudian, MySQL mungkin satu-satunya server database yang digunakan di sebagian besar proyek opensource. Namun, perubahan lisensi yang dilakukan oleh Oracle, perusahaan induk baru membentuk alternatif MySQL yang disebut MariaDB.

MariaDB adalah pengganti drop-in untuk MySQL. Ini berarti bahwa untuk banyak kasus, Kamu dapat menghapus MySQL dan menginstal MariaDB dan Kamu siap melakukannya. Secara umum tidak ada kebutuhan untuk mengonversi file data apa pun.

Basis data apa pun yang Kamu gunakan, perintah di bawah ini akan berfungsi untuk mengetahui versi MySQL atau MariaDB.

Untuk mulai memeriksa versi database MySQL atau MariaDB, ikuti langkah-langkah di bawah ini:

Periksa versi Server MySQL

MySQL dan MariaDB hadir dengan alat bawaan yang memungkinkan Kamu memeriksa versi server. Cukup jalankan perintah di bawah ini dengan argumen -d untuk menampilkan versi server saat ini.

mysqld --version

Menjalankan perintah di atas akan menunjukkan versi mana yang dijalankan server.

MySQL output:
/usr/sbin/mysqld  Ver 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))

MariaDB output:
mysqld  Ver 10.3.25-MariaDB-0ubuntu0.20.04.1 for debian-linux-gnu on x86_64 (Ubuntu 20.04)

Jika Kamu menjalankan perintah di bawah ini, seharusnya juga menampilkan versi server

mysqladmin -V

Keluaran dari perintah di atas.

MySQL output:
mysqladmin  Ver 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))

MariaDB output:
mysqladmin  Ver 9.1 Distrib 10.3.25-MariaDB, for debian-linux-gnu on x86_64

MySQL dan MariaDB hadir dengan alat klien yang juga akan membantu Kamu menemukan versi server. Dari baris perintah, aktifkan alat klien dengan menjalankan perintah di bawah ini:

sudo mysql

Itu akan memungkinkan Kamu untuk masuk dan menampilkan detail server termasuk nomor versi.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)
Copyright (c) 2000, 2021, 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> 

Server MariaDB akan menampilkan pesan di bawah ini:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 49
Server version: 10.3.25-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04
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)]>

Atau jalankan kueri STATUS untuk menampilkan detail server termasuk nomor versi.

mysql> STATUS;

Itu akan menampilkan output di bawah ini:

Connection id:        9
 Current database:    
 Current user:        [email protected]
 SSL:            Not in use
 Current pager:        stdout
 Using outfile:        ''
 Using delimiter:    ;
 Server version:        8.0.23-0ubuntu0.20.04.1 (Ubuntu)
 Protocol version:    10
 Connection:        Localhost via UNIX socket
 Server characterset:    utf8mb4
 Db     characterset:    utf8mb4
 Client characterset:    utf8mb4
 Conn.  characterset:    utf8mb4
 UNIX socket:        /var/run/mysqld/mysqld.sock
 Binary data as:        Hexadecimal
 Uptime:            6 min 54 sec
 Threads: 2  Questions: 5  Slow queries: 0  Opens: 117  Flush tables: 3  Open tables: 36  Queries per second avg: 0.012

Beberapa metode ini membantu Kamu menentukan versi server MySQL atau MariaDB dari konsol baris perintah.

Menggunakan phpMyAdmin

Jika Kamu telah menginstal phpMyAdmin, Kamu juga dapat melihat versi server dari portal. Masuk dan lihat detail server dari dasbor.

Menggunakan PHP

Jika Kamu dapat mengunggah file ke direktori root web Kamu, cukup buat file lokal bernama mysqlversion.php. Kemudian salin dan tempel kode di bawah ini ke dalam file dan unggah ke folder root server Kamu.

<?php

// Create a database connection.
$link = mysqli_connect("localhost", "root", "root_password");

// Print the MySQL version.
echo mysqli_get_server_info($link);

// Close the connection.
mysqli_close($link);

Kemudian browser ke hostname server atau alamat IP diikuti oleh mysqlversion.php

MySQL output:
/usr/sbin/mysqld  Ver 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))

MariaDB output:
mysqld  Ver 10.3.25-MariaDB-0ubuntu0.20.04.1 for debian-linux-gnu on x86_64 (Ubuntu 20.04)
0

Itu akan menampilkan versi server Kamu.

Cek versi mysql ubuntu

Mungkin ada cara lain untuk melihat nomor versi server database Kamu di Ubuntu Linux. Namun, beberapa metode di atas akan membantu Kamu memulai.

Kesimpulan:

Posting ini menunjukkan kepada Kamu cara menemukan nomor versi server database MySQL atau MariaDB di Ubuntu Linux. Jika Kamu menemukan kesalahan di atas, silakan gunakan formulir komentar di bawah untuk melaporkan.

Rate this post

Facebook

Twitter

Linkedin

ReddIt

Telegram

Tumblr

Cek versi mysql ubuntu

Arnelita

https://dengkul.com

Don’t be afraid to fail. It’s not the end of the world, and in many ways, it’s the first step toward learning something and getting better at it.