#mysql #ubuntu #ubuntuserver #ubuntuserver2204 #db #debian #linux #yourls
**[Skip to English](#english)**
Onderstaand een uitleg hoe Mysql te installeren tbv #yourls
Om MySQL te installeren op een Ubuntu server voor het opzetten van een YOURLS-server, volg je deze stappen:
Update je pakketlijst: Voordat je software installeert, is het altijd goed om de pakketlijst bij te werken:
```sudo apt update```
Installeer MySQL-server: Gebruik de volgende command om de MySQL-server te installeren:
```sudo apt install mysql-server```
Beveilig de MySQL-installatie: Na installatie kun je de beveiligingsscript draaien om de beveiliging van MySQL te verbeteren:
```sudo mysql_secure_installation```
Je zult verschillende prompts krijgen, waaronder:
De root-wachtwoord instellen.
Onbeveiligde gebruikers verwijderen.
Toegang tot de root-omgeving beperken tot alleen lokale verbindingen.
Testdatabases verwijderen.
Controleer de status van MySQL: Om te controleren of MySQL correct draait, kun je de volgende command uitvoeren:
```sudo systemctl status mysql```
Je moet een bericht zien dat MySQ L actief is.
MySQL Shell gebruiken om een database te maken voor YOURLS: Log in op de MySQL-shell:
```sudo mysql```
Maak vervolgens een database en een gebruiker aan voor YOURLS. Hier is een voorbeeld:
```CREATE DATABASE yourls_db;```
```CREATE USER 'yourls_user'@'localhost' IDENTIFIED BY 'sterk_wachtwoord';```
```GRANT ALL PRIVILEGES ON yourls_db.* TO 'yourls_user'@'localhost';```
```FLUSH PRIVILEGES;```
```EXIT;```
## English
To install **MySQL** on an **Ubuntu server** for setting up a **YOURLS** server, follow these steps:
---
### **1. Update Your Package List**
Before installing software, it is always a good practice to update the package list:
`sudo apt update`
---
### **2. Install MySQL Server**
Use the following command to install the **MySQL server**:
`sudo apt install mysql-server`
---
### **3. Secure the MySQL Installation**
After installation, run the **security script** to improve MySQL security:
`sudo mysql_secure_installation`
You will receive several prompts, including:
✅ **Setting the root password**
✅ **Removing unsecured users**
✅ **Restricting root access to local connections only**
✅ **Removing test databases**
---
### **4. Check the Status of MySQL**
To verify that MySQL is running correctly, execute the following command:
`sudo systemctl status mysql`
You should see a message indicating that **MySQL is active**.
---
### **5. Use MySQL Shell to Create a Database for YOURLS**
Log into the **MySQL shell**:
`sudo mysql`
Then create a **database** and **user** for YOURLS. Here’s an example:
`CREATE DATABASE yourls_db; CREATE USER 'yourls_user'@'localhost' IDENTIFIED BY 'strong_password'; GRANT ALL PRIVILEGES ON yourls_db.* TO 'yourls_user'@'localhost'; FLUSH PRIVILEGES; EXIT;`
---
After completing these steps, MySQL is **installed and configured** for **YOURLS**. 🚀
[[How to shrink an oversized SQL LOG file]]
[[Check SQL Database Health]]
[[TroubleShooting SQL Connection Problems]]