Как установить MariaDB 10.5 на Ubuntu 20.04 (Focal Fossa)

mariadb

Как установить MariaDB 10.5 на Ubuntu 20.04 (Focal Fossa)

 

Как я могу установить MariaDB 10.5 на сервер Ubuntu 20.04 (Focal Fossa)? MariaDB — это популярная замена MySQL-сервера базы данных дополнительными функциями, новыми механизмами хранения и улучшенной производительностью. Вы можете проверить полный список функций MariaDB 10.5 на официальном сайте. Сервер базы данных MariaDB публикуется как бесплатное программное обеспечение с открытым исходным кодом под лицензией General Public License версии 2.

Установите MariaDB 10.5 на Ubuntu 20.04 LTS

Чтобы установить MariaDB 10.5 в Ubuntu 20.04, вам необходимо добавить репозиторий MariaDB в систему. Затем установка MariaDB 10.5 на Ubuntu 20.04 будет произведена из репозитория APT, добавленного без каких-либо проблем.

Шаг 1: Обновление системы

Убедитесь, что ваша система обновлена ​​и установите общий пакет свойств программного обеспечения.

sudo apt update && sudo apt upgrade
sudo apt -y install software-properties-common

Шаг 2. Импортируйте ключ MariaDB gpg:

Запустите команду ниже, чтобы добавить ключ хранилища в систему:

sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'

Шаг 3: Добавить репозиторий MariaDB APT

После импорта ключа GPG репозитория добавьте репозиторий APT, выполнив следующую команду:

sudo add-apt-repository 'deb [arch=amd64] http://mariadb.mirror.globo.tech/repo/10.5/ubuntu focal main'

Вывод выполнения команды:

Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://nova.clouds.archive.ubuntu.com/ubuntu focal InRelease        
Get:3 http://mariadb.mirror.globo.tech/repo/10.5/ubuntu focal InRelease [3202 B]
Hit:4 http://nova.clouds.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://nova.clouds.archive.ubuntu.com/ubuntu focal-backports InRelease
Get:6 http://mariadb.mirror.globo.tech/repo/10.5/ubuntu focal/main amd64 Packages [7924 B]
Fetched 11.1 kB in 1s (15.6 kB/s)
Reading package lists... Done

Шаг 4: Установите сервер MariaDB в Linux 20.04

Последний шаг — установка сервера MariaDB:

sudo apt update
sudo apt install mariadb-server mariadb-client

Хит у клавиши , чтобы принять установку MariaDB 10.5 на Ubuntu 20.04 Linux.

The following additional packages will be installed:
  galera-4 libcgi-fast-perl libcgi-pm-perl libdbd-mariadb-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl libhtml-tagset-perl
  libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmariadb3 libmysqlclient21
  libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.5 mariadb-client-core-10.5 mariadb-common mariadb-server-10.5
  mariadb-server-core-10.5 mysql-common socat
Suggested packages:
  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx mariadb-test
  tinyca
The following NEW packages will be installed:
  galera-4 libcgi-fast-perl libcgi-pm-perl libdbd-mariadb-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl libhtml-tagset-perl
  libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmariadb3 libmysqlclient21
  libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client mariadb-client-10.5 mariadb-client-core-10.5 mariadb-common mariadb-server
  mariadb-server-10.5 mariadb-server-core-10.5 mysql-common socat
0 upgraded, 28 newly installed, 0 to remove and 0 not upgraded.
Need to get 29.5 MB of archives.
After this operation, 229 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Шаг 5: Безопасный сервер MariaDB в Linux 20.04

Вы должны вручную запустить сценарий защиты MySQL.

$ sudo 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
haven't set the root password yet, you should just press enter here.

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

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

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, 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!

Служба базы данных должна запускаться автоматически после установки.

$  systemctl status mysql
● mariadb.service - MariaDB 10.5.2 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: active (running) since Sat 2020-04-25 23:57:39 UTC; 2min 8s ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 4309 (mysqld)
     Status: "Taking your SQL requests now..."
      Tasks: 11 (limit: 2344)
     Memory: 82.5M
     CGroup: /system.slice/mariadb.service
             └─4309 /usr/sbin/mysqld

Apr 25 23:57:44 ubuntu20 /etc/mysql/debian-start[4332]: mysql
Apr 25 23:57:44 ubuntu20 /etc/mysql/debian-start[4332]: performance_schema
Apr 25 23:57:44 ubuntu20 /etc/mysql/debian-start[4332]: Phase 6/7: Checking and upgrading tables
Apr 25 23:57:44 ubuntu20 /etc/mysql/debian-start[4332]: Processing databases
Apr 25 23:57:44 ubuntu20 /etc/mysql/debian-start[4332]: information_schema
Apr 25 23:57:44 ubuntu20 /etc/mysql/debian-start[4332]: performance_schema
Apr 25 23:57:44 ubuntu20 /etc/mysql/debian-start[4332]: Phase 7/7: Running 'FLUSH PRIVILEGES'
Apr 25 23:57:44 ubuntu20 /etc/mysql/debian-start[4332]: OK
Apr 25 23:57:44 ubuntu20 /etc/mysql/debian-start[5138]: Checking for insecure root accounts.
Apr 25 23:57:44 ubuntu20 /etc/mysql/debian-start[5142]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables

Проверьте вход в оболочку MariaDB с помощью mysql команды:

$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 56
Server version: 10.5.2-MariaDB-1:10.5.2+maria~focal-log mariadb.org binary distribution

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)]> 

Проверьте версию с помощью команды:

MariaDB [(none)]> SELECT VERSION();
+-----------------------------------------+
| VERSION() |
+-----------------------------------------+
| 10.5.2-MariaDB-1:10.5.2+maria~focal-log |
+-----------------------------------------+
1 row in set (0.000 sec)
MariaDB [(none)]>

Шаг 5: Установите инструмент управления базами данных рабочего стола

Если работа с командной строкой MySQL — это не то, что вам нужно, подумайте об установке Database Tool, чтобы вам помочь Ознакомьтесь с нашим руководством ниже:

Установите и настройте DBeaver в Ubuntu

Author: forgero

1 thought on “Как установить MariaDB 10.5 на Ubuntu 20.04 (Focal Fossa)

Comments are closed.