I. Overview
This document describes how to install MariaDB on Ubuntu 14.04.
MariaDB is a derivative version of the popular MySQL database. It can also be considered as a branch of MySQL and is maintained by the open-source community. MariaDB uses the GPL license. MariaDB is designed to be fully compatible with MySQL, including APIs and command lines, so that it can easily become a substitute for MySQL. In terms of storage engine, XtraDB is used to replace InnoDB of MySQL.
II. MariaDB
The MariaDB software package is included in the software repository of Ubuntu 14.04.
1. Install MariaDB from the software warehouse
Run the following command:
# Sudo apt-get install mariadb-server
Note: If an error such as "E: Unable to locate package MariaDB-server" occurs, you need to update the system.
# Sudo apt-get update
If the same error is still reported, you must:
# Add-apt-repository 'Deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu quantal main'
The program 'add-apt-repository 'is currently not installed. You can install it by typing:
Apt-get install python-software-properties
Run Again
# Apt-get install python-software-properties
2. Set the password for the root account of the MariaDB database
Enter the password of the root account of the MariaDB database as prompted.
Once the password is set, the installation is complete.
III. Secure installation
The default installation includes the default settings and default accounts. It is good for the test system, but there is a security problem for the production system.
For example, if no password is set for the root account, anyone can access the database. Fortunately, we can close these security risks by running a script.
1. Run the secure installation script
Ensure that MariaDB is running before running the secure installation script.
#/Usr/bin/mysql_secure_installation
2. You will be prompted to enter the password of the root account. If the password has been set during the previous installation, you can press "N" to skip this step.
3. You will be prompted to change the password of the root account. Press "Y" to reset the password.
4. You will be prompted to delete anonymous users. Press "Y" to confirm.
5. You will be prompted whether to allow remote access from the root account. Press "Y" to confirm.
6. You will be prompted to delete the test database, and press "Y" to confirm.
7. Re-load the permission table and press "Y" to confirm.
4. Log on to MariaDB
Enter the following command to log on to the MariaDB database.
# Mysql-u <username>-p
5. Allow remote connection
By default, MariaDB only listens to local connections. This means that only the MariaDB database can be accessed locally. This is also a typical LAMP architecture configuration method.
If the Web application and MariaDB database are deployed on different servers, we need to configure MariaDB to listen for remote network access.
1. Open the configuration file of MariaDB.
# Nano/etc/mysql/my. cnf
Find the following content
Bind-address: 127.0.0.1
Modify this address to add the IP address of the server that allows remote access.
Save and exit.
2. Restart MariaDB.
# Sudo service mysql restart
How to install MariaDB on Ubuntu 14.04 LTS
We will discuss how to install MariaDB on Ubuntu. By default, the MariaDB package is not in the Ubuntu repository. To install MariaDB, we must first set up the MariaDB repository.
Set MariaDB repository
$ Sudo apt-get install software-properties-common
$ Sudo apt-key adv -- recv-keys -- keyserver hkp: // keyserver.ubuntu.com: 80 0xcbcb082a1bb943db
$ Sudo add-apt-repository 'Deb http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty main'
Install MariaDB:
$ Sudo apt-get update
$ Sudo apt-get install mariadb-server
During installation, you are required to set the root password of MariaDB.
Connect to MariaDB from the command line:
Linuxtechi @ mail :~ $ Mysql-uroot-p
Enter password:
Welcome to the MariaDB monitor. Commandsendwith; or \ g.
YourMariaDB connection id is40
Server version: 10.0.14-MariaDB-1 ~ Trusty-log mariadb.org binary distribution
Copyright (c) 2000,2014, Oracle, SkySQLAband others.
Type 'help; 'or' \ H' for help. Type' \ C' to clear the current input statement.
MariaDB [(none)]>
MariaDB service
$ Sudo/etc/init. d/mysql stop
$ Sudo/etc/init. d/mysql start