Thursday, December 1, 2022

MariaDB on Ubuntu 22.04

Installing and maintaining MariaDB on Ubuntu 22.04 is essentially the same as running MySQL.

Useful Commands

View Error Log

$ sudo less /var/log/mysql/error.log

Open mysql shell as root

$ sudo mysql

Display Users

> SELECT User, Host, Password FROM mysql.user;

Create User

> CREATE USER 'user_name'@'host_name' IDENTIFIED BY 'password';

Remove User

> DROP USER [IF EXISTS] 'user_name'@'host_name';

Grant User Permissions

> GRANT ALL PRIVILEGES ON db_name.* TO 'user_name'@'host_name';
> FLUSH PRIVILEGES;

Show Privileges

> SHOW GRANTS FOR 'user_name'@'host_name';

Create WordPress Database

> CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Leave a Reply

Your email address will not be published.