Ubuntu16apt-get installation Mariadb__ubuntu

Source: Internet
Author: User
Tags anonymous percona percona server
First, MySQL background information
MySQL has been popular in the early days of the Internet, pursuing speed, simplicity, open source, and almost all operating systems. Fully support multi-user, multithreading, support mass data storage, the use of MyISAM, InnoDB two major storage engines complement each other. But as InnoDB and MySQL themselves were acquired by Oracle, the founder of MySQL developed MARIADB.
MARIADB's biggest feature is the use of XTRADB storage engine, and compatible with the original version, retained the free and open MySQL, XTRADB is the Percona development of high-performance storage engine, The main purpose is to replace InnoDB. In addition to the XTRADB engine, the Up-and-comer Tokudb supports high-performance, transaction-processing storage engines, with a much higher performance than InnoDB, high insert performance, high compression ratio, support for online modification of indexes, adding fields.
MySQL, mariadb, Percona Server cannot coexist during installation, and the other two must be uninstalled to deploy MARIADB. Otherwise the "MySQL service masked" error occurs.
Second, install mariadb
1. Installing the database environment
dream361@ubuntu16:~$ sudo aptitude install-y mariadb-server mariadb-client
2. Install database instance
dream361@ubuntu16:~$ sudo mysql_secure_installation
Note:running all PARTS The This SCRIPT are recommended for all mariadb SERVERS in PRODUCTION use!

Please READ each step carefully!  In order to log into mariadb to secure it, we'll need the current password for the root user. If you ' ve just installed MARIADB, and you haven ' t set the root password yet, the password'll be blank, so you should jus

T press ENTER here.

Enter current password for root (enter for none): Set root password 1 OK, successfully used password, moving on ...

Setting The root password ensures that nobody can log into the mariadb root user without the proper.

You are already have a root password set, so can safely answer ' n '. Change the root password?

[y/n] n Change Password: n does not change ... skipping. By default, a MARIADB installation has of anonymous user, allowing anyone to log into mariadb without have to have a use  R account created for them.  This is intended only for testing, and to make the installation go a bit smoother. You should remove them before MovinG into a production environment. Remove anonymous users? [y/n] y to remove test User: Y yes ...

success!  Normally, Root should only is allowed to connect from ' localhost '.

This ensures is someone cannot guess at the root password from the network. Disallow root login remotely? [y/n] Y allows root telnet: n does not allow ...

success!  By default, MARIADB comes with a database named ' Test ' anyone can access.

This is also intended only for testing, and should are removed before into a moving production. Remove test database and access to it? [y/n] Y Delete test database Test:y erase-dropping test db ...
 success! -Removing privileges on test database ...

success!

Reloading the privilege tables would ensure this all changes made so far would take effect. Reload privilege tables now? [y/n] Y reload permission table: Y reload ...

success!

Cleaning up ...  All done!

If you have ' ve completed all of the the above steps, your MARIADB installation should now is secure. The for using MARIADB

3. View MARIADB Database service status (this also shows that mariadb and other MySQL databases cannot coexist in the same operating system)

dream361@ubuntu16:~$ sudo systemctl status MySQL
4. Start the MARIADB database service

dream361@ubuntu16:~$ sudo systemctl start MySQL

3. Set MySQL to start with system services

dream361@ubuntu16:~$ sudo update-rc.d  mysql defaults
4. Undo starts with system service
dream361@ubuntu16:~$ sudo update-rc.d-  f MySQL Remove
5. Unlike previous versions of MySQL, you need to obtain operating system administrator privileges to log on to the root user of the mariadb, and ordinary operating system users cannot log on to MARIADB database root
dream361@ubuntu16:~$ sudo mysql-u root-p
6. Backup MySQL database also requires operating system administrator to perform backup
dream361@ubuntu16:~$ sudo mysqldump-uroot-p mysql >mysql.sql
7. Create an ordinary database user (logon to normal database users do not need to obtain operating system administrator rights)
Create user ' henry ' @ '% ' identified by ' 1 ';
8. Log in to remote database (requires henry@ '% ')
dream361@ubuntu16:~$ mysql-h localhost-u HENRY-P1

9. Modify the MARIADB configuration file to monitor the extranet access

# Instead of skip-networking The default is now to listen only
# localhost which are more compatible and are not less secure.
#bind-address = 127.0.0.1 #注释掉这一行

10. Restart the database service for the configuration to take effect

dream361@ubuntu16:~$ sudo systemctl restart MySQL

11.MariaDB version

dream361@ubuntu16:~$ mysql-v
mysql  Ver 15.1 distrib 10.0.29-mariadb, for Debian-linux-gnu (x86_64) using ReadLine 5.2


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.