Mariadb (Mysql) Setup
I wrote these instructions years ago, but couldn’t find them the other day. So I’m updating a few things and reposting here.
Make sure you have mysql in /etc/group. Normally the gid is 27.
It wants to put a file in /var/run/mariadb. Remember that this is a tempfile on rhel7. So you need to remake this directory on every boot. Create /etc/tmpfiles.d/mariadb.conf with:
# mariadb needs a directory in /var/run to store its pid file and args file d /var/run/mariadb 0755 mysql mysql
After installing mariadb-server, need to set a password and delete all the default users that have no password.
# systemctl start mariadb # mysqladmin -u root password 'new_password' # mysql -u root -p mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec) mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select Host,User,Password from user where user=''; +-----------+------+----------+ | Host | User | Password | +-----------+------+----------+ | comp | | | | localhost | | | +-----------+------+----------+ 2 rows in set (0.00 sec) mysql> select Host,User,Password from user where Password=''; +-----------+------+----------+ | Host | User | Password | +-----------+------+----------+ | comp | root | | | comp | | | | localhost | | | +-----------+------+----------+ 3 rows in set (0.00 sec) Now need to delete those empty users. mysql> delete from user where User=''; Query OK, 2 rows affected (0.00 sec) mysql> select Host,User,Password from user where Password=''; +------+------+----------+ | Host | User | Password | +------+------+----------+ | comp | root | | +------+------+----------+ 1 row in set (0.00 sec) mysql> delete from user where Password=''; Query OK, 1 row affected (0.00 sec) mysql> select Host,User,Password from user; +-----------+------+------------------+ | Host | User | Password | +-----------+------+------------------+ | localhost | root | 1e3392c069a69a58 | +-----------+------+------------------+ 1 row in set (0.00 sec)