MirrorNest
← Tüm kılavuzlar

MySQL / MariaDB on Ubuntu

The most widely-used open-source relational database family -- MariaDB is Ubuntu's default drop-in replacement for MySQL, fully compatible with the same client tools and SQL syntax.

Hedef: Ubuntu 22.04 LTS / 24.04 LTSDatabaseResmi ana sayfa ↗Resmi belgeler ↗
Bu kılavuz, yukarıda bağlantısı verilen MySQL / MariaDB on Ubuntu kendi resmi belgelerinden derlenmiştir — dağıtım ve proje sürümleri zamanla değiştiğinden, bu komutları bir üretim sunucusunda çalıştırmadan önce tam paket/sürüm adlarını her zaman orada kontrol edin.
  1. 1Install MariaDB

    sudo apt update
    sudo apt install mariadb-server
  2. 2Run the security setup script

    Sets a root password, removes anonymous users and the test database, and disables remote root login -- answer "yes" to each prompt for a production-appropriate default.

    sudo mysql_secure_installation
  3. 3Create a database and a dedicated user for your app

    sudo mysql -u root -p
    CREATE DATABASE myappdb;
    CREATE USER 'myappuser'@'localhost' IDENTIFIED BY 'a-real-password';
    GRANT ALL PRIVILEGES ON myappdb.* TO 'myappuser'@'localhost';
    FLUSH PRIVILEGES;

    Never connect your app as the root database user -- a dedicated, narrowly-scoped user limits the damage if the app itself is ever compromised.