Database

Install

After checking that the system is up to date, run:

TXT
sudo apt install -y mysql-server
TXT
sudo systemctl start mysql.service

Configure

Access to MySQL command line:

TXT
sudo mysql

Copy/paste this line and validate:

TXT
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
TXT
quit

Secure install

TXT
sudo mysql_secure_installation

We answer a serie of questions, validating each time with Enter.
Change at least the blinking examples:

  • The password is password
  • y to validate password component
  • 2 for strong password policy
  • y to change root password
  • new-root-password
  • y to continue with the password
  • y to remove anonymous users
  • y to disallow root login remotely
  • y to remove test database
  • y to reload privilege tables

Reconnect:

TXT
mysql -u root -p

Password is new-root-password.

TXT
ALTER USER 'root'@'localhost' IDENTIFIED WITH auth_socket;

Admin user

Create another MySQL "superuser" to avoid using MySQL root in the future:

CREATE USER 'leguellec'@'localhost' IDENTIFIED BY 'superuser-password';
TXT
GRANT ALL PRIVILEGES ON *.* TO 'leguellec'@'localhost' WITH GRANT OPTION;

Pixelfed database

Create a Pixelfed database:

TXT
CREATE DATABASE pixelfed_fediverse_ovh;

Create a MySQL dedicated user:

CREATE USER 'user_pixelfed'@'localhost' IDENTIFIED BY 'user-password';
TXT
GRANT ALL PRIVILEGES ON pixelfed_fediverse_ovh.* TO 'user_pixelfed'@'localhost';
TXT
FLUSH PRIVILEGES;
TXT
quit