MariaDB database server is an open source server that is a fork of MySQL and a drop-in replacement… It is now the fastest growing open source database server today…
Over the many years, MySQL was the undisputed king of database servers for all of Linux systems… It only lost that title to MariaDB after MySQL current parent company, Oracle made some changes to its licensing terms that angered lots of people in the open source community… and that when MariaDB was borned.
Today, MariaDB is the default database server on the majority of Linux distributions, if not all.
For those who want to test MariaDB on Ubuntu 18.04 LTS , the steps below will get you started.
Step 1: Installing MariaDB Database Server
It takes a single command line to install MariaDB Database Server.. to do that, run the commands below
sudo apt update
sudo apt install mariadb-server mariadb-client
After installing, the commands below can be used to stop, start and enable MariaDB service to always start up when the server boots.
sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl restart mariadb.service
sudo systemctl enable mariadb.service
After that, run the commands below to secure MariaDB server by creating the root user password and deleting the test database.
sudo mysql_secure_installation
When prompted, answer the questions below by following the guide.
Enter current password for root (enter for none): Just press the Enter
Set root password? [Y/n]: Y
New password: Enter password
Re-enter new password: Repeat password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y
Restart MariaDB server when done.
sudo systemctl restart mariadb.service
登录
sudo mysql -u root -p #输入root 用户密码
创建远程登录用户
use mysql;
create user 'lxgzhw'@'%' identified by 'lxgzhw';
授权(如果权限不足)
GRANT ALL PRIVILEGES ON *.* TO 'us'@'%' IDENTIFIED BY '123' WITH GRANT OPTION;
这一句容易出错,最好直接复制进去
FLUSH PRIVILEGES;
Step 2: Configuring MariaDB Database Server
Now that MariaDB server is installed… the default configuration file is located at /etc/mysql/mariadb.config.d/50-server.cnf… this is where you enter config directives to optimize and enhance the database server performance. Most of the settings you’ll be looking for will be in this file.
sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
把bind注释掉
Make all the changes you want in the file above and save… then restart the server.
sudo systemctl restart mariadb.service
That’s it! This is how to install MariaDB database server on Ubuntu 18.04 LTS
Enjoy!