androide

Come installare mysql su debian 10 linux

Debian 10: Installing MySQL (not MariaDB)

Debian 10: Installing MySQL (not MariaDB)

Sommario:

Anonim

MySQL, il sistema di gestione di database relazionali open source più famoso al mondo non è disponibile nei repository predefiniti di Debian. MariaDB è il sistema di database predefinito in Debian 10.

Questo tutorial spiega come installare e proteggere MySQL su Debian 10 dal repository Apt di MySQL.

Configurazione del repository MySQL

Per aggiungere il repository APT MySQL al tuo sistema vai alla pagina di download del repository e scarica l'ultimo pacchetto di rilascio usando il seguente comando wget:

wget

Una volta completato il download, installare il pacchetto di rilascio come utente con privilegi sudo:

sudo apt install./mysql-apt-config_0.8.13-1_all.deb

Ti verrà presentato il menu di configurazione da cui puoi selezionare la versione di MySQL che desideri installare.

Una volta completata l'installazione, il servizio MySQL si avvierà automaticamente, puoi verificarlo digitando:

sudo systemctl status mysql

● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en Active: active (running) since Fri 2019-07-26 13:23:25 PDT; 37s ago…

Protezione di MySQL

Esegui il comando mysql_secure_installation per impostare la password di root e migliorare la sicurezza dell'installazione di MySQL:

sudo mysql_secure_installation

Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No:

Ti verrà chiesto di configurare il VALIDATE PASSWORD PLUGIN che viene utilizzato per testare la forza delle password degli utenti MySQL. Esistono tre livelli di criteri di convalida della password, basso, medio e forte. Premere ENTER se non si desidera impostare il plug-in di convalida password.

Please set the password for root here. New password: Re-enter new password:

Al prompt successivo, ti verrà chiesto di impostare una password per l'utente root di MySQL.

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!

Dopo aver impostato la password di root, lo script ti chiederà anche di rimuovere l'utente anonimo, limitare l'accesso dell'utente root al computer locale e rimuovere il database di test. Devi rispondere "Y" (sì) a tutte le domande.

Connessione al server MySQL

Per interagire con MySQL attraverso il terminale, utilizzare il client mysql installato come dipendenza del pacchetto server MySQL.

Se hai selezionato il metodo di autenticazione predefinito per accedere al server MySQL come tipo di utente root:

sudo mysql

Altrimenti, se è stato selezionato il metodo di autenticazione legacy per accedere digitare:

mysql -u root -p

Ti verrà richiesto di inserire la password di root che hai impostato in precedenza quando è stato eseguito lo script mysql_secure_installation . Una volta inserita la password ti verrà presentata la shell MySQL come mostrato di seguito:

Welcome to the MySQL monitor. Commands end with; or \g. Your MySQL connection id is 10 Server version: 8.0.17 MySQL Community Server - GPL…

Conclusione

In questo tutorial, hai imparato come installare e proteggere un server MySQL su un server Debian 10. Ti abbiamo anche mostrato come connetterti alla shell MySQL.

Se la tua applicazione non ha requisiti specifici, dovresti seguire MariaDB, il sistema di database predefinito in Debian 10.

mysql debian