CentOS7 installation mariadb

Source: Internet
Author: User

MARIADB database management System is a branch of MySQL. One of the reasons for developing this branch is that after Oracle acquired MySQL, there is a potential risk of shutting MySQL out of the source, so the community uses a branching approach to avoid this risk. MARIADB is designed to be fully compatible with MySQL, including APIs and command lines, making it easy to be a replacement for MySQL. Some of the top sites, such as Google, wiki, LinkedIn, and Mozilla, have migrated to MARIADB.

Installation of MySQL, found to be CentOS 7 version of the MySQL database software removed from the default program list, with MARIADB instead. No problem, toss the little sea lions.

System environment:

To install MARIADB server and client:

[email protected] ~]# Yum install mariadb-server mariadb

Wait for the installation to complete. Turn on MARIADB server, and set the boot from boot.

[[email protected] ~]# systemctl start mariadb.service[[email protected] ~]# systemctl enable Mariadb.serviceln-s '/usr/l Ib/systemd/system/mariadb.service '/etc/systemd/system/multi-user.target.wants/mariadb.service '

MariaDB Server default root password is empty, there are two ways to reset the root password, one is the traditional method, log in to MySQL change password, one is to use mysql_secure_installation.

Method 1:

Log in to MARIADB, enter MySQL database, update password

 

[[email protected] ~]# mysql-u rootmariadb [(none)]> use MySQL; MariaDB [mysql]> Update user set Password=password ("password written in this") where user= ' root ';

Flush privileges is required to flush the MySQL system permissions related tables, otherwise access will be denied. Quit and log back in.

MariaDB [mysql]> flush Privileges; MariaDB [mysql]> quit re-login with new password [[email protected] ~]# mysql-u root-p

Method 2:

[[email protected] ~]# mysql_secure_installation/usr/bin/mysql_secure_installation:line 379:find_mysql_ Client:command not foundnote:running All PARTS of this SCRIPT was 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 CurrentPassword for the root user. If you ' ve just installed MariaDB, Andyou Haven ' t set the root password yet, the password would be a blank,so you should just Press ENTER here. Enter current password to root (enter for none)://password is empty, direct carriage return OK, successfully used password, moving on ... Setting The root password ensures that nobody can log into the Mariadbroot user without the proper authorisation. Set root Password? [y/n] Y//whether to set root password new Password:re-enter new Password:password updated successfully! Reloading privilege tables. ... success!  By default, a MariaDB installation had an anonymous user, allowing Anyoneto log into MariaDB without had to had a user AccouNT created Forthem.  This was intended only for testing, and the Installationgo a bit smoother. You should remove them before moving into aproduction environment. Remove anonymous users? [y/n] Y//clear Anonymous user ... success!  Normally, Root should only is allowed to connect from ' localhost '. Thisensures that someone cannot guess at the root of password from the network. Disallow Root login remotely? [y/n] n//Do not allow root remote connection ... skipping.  By default, the MariaDB comes with a database named ' Test ' anyone canaccess. This was also intended only for testing, and should was removedbefore moving into a production environment. Remove test database and access to it? [y/n] Y//delete test database-dropping test ... success! -Removing privileges on test database ... success! Reloading the privilege tables would ensure that all changes made so farwill take effect immediately. Reload privilege tables now? [y/n] Y//Reload Permissions Table ... success! Cleaning up ...  All done! If you ' ve completed all of the above StEPS, your mariadbinstallation should now is secure. Thanks for using mariadb!

OK, now re-enter

[Email protected] ~]# mysql-u root-p Enter password:welcome to the MariaDB Monitor.  

There is also an important step in setting the Allow remote user access.

MariaDB [(None)]> GRANT all privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with GRANT OPTION; Query OK, 0 rows affected (0.01 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows Affected (0.00 sec)

"%" means that any host can log on remotely to the server for access. If you want to restrict access to only one machine, replace it with the appropriate IP

Turn on port 3306. CENTOS7 enabled FIREWALLD to replace the original iptables. Since new things appear, there must be a reason for it to appear.

[[email protected] ~]# systemctl start firewalld//Start FIREWALLD Service
[Email protected] ~]# Firewall-cmd--state
Running

[[email protected] ~]# firewall-cmd--zone=public--add-port=80/tcp--permanent//Open port

Success

[Email protected] ~]# Firewall-cmd--reload
Success

Command meaning:--zone #作用域--add-port=80/tcp  #添加端口, in the format: Port/Communication protocol--permanent   #永久生效, fail to restart the firewall without this parameter reboot

Confirm that the port is actually turned on:

[Email protected] ~]# NETSTAT-NTLP | grep 3306tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      2911/mysqld         

 

Bingo! Continue to Toss

CentOS7 Install mariadb

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.