Install MySQL on Archlinux

Install mariadb without starting mysqld :

pacman -Sy mariadb

Install the database :

mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Start the mysqld service, and run mysql_secure_installation :

  • Give a biiiiigg password to the root user and disable remote access to it
  • Remove anonymous user accouts
  • Remove the test database

Restart the mysqld service, and connect to the database using mysql -u root -p. Run the following commands :

  • CREATE USER '[USERNAME]'@'localhost' IDENTIFIED BY '[A_GOOD_PASS]';
  • CREATE DATABASE [USER]_db;
  • GRANT ALL PRIVILEGES ON [THE_SAME_DB].* TO '[THE_SAME_USER]'@'%';
  • FLUSH PRIVILEGES;

Now edit /etc/mysql/my.cnf and comment (with #) the lines:

  • #bind-address = <some ip-address>
  • #skip-networking

Restart mysqld. Congratulations, you just install the worst database ever on the best OS ever.