Install MariaDB on Ubuntu
Task: Install mariaDB server on Ubuntu
Implementation:
- Update packages:
sudo apt update
sudo apt upgrade - Install MariaDB server package:
sudo apt install mariadb-server - Check status of service:
sudo systemctl status mariadb - Check version:
mysql -V - Test it working:
sudo mysql
Modify current root user access (recreate it):
sudo mysql -u root
mysql> SELECT User,Host FROM mysql.user;
mysql> DROP USER 'root'@'localhost';
mysql> CREATE USER 'root'@'%' IDENTIFIED BY '';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
Create database and some another user:
mysql -u root -p
mysql> create database testdb;
mysql> grant all privileges on testdb.* to someuser@127.0.0.1 identified by 'somepass' with grant option;
mysql> grant all privileges on testdb.* to someuser@localhost identified by 'somepass' with grant option;
mysql> grant all privileges on testdb.* to someuser@'%' identified by 'somepass' with grant option;
Test it:
mysql --user=someuser --password=somepass --database=testdb
Done.