CentOS 7.4 How to install the MariaDB 10.3.9 Stable database

Source: Internet
Author: User
Tags gpg


How to install CentOS 7.4MariaDB 10.3.9 StableDatabase one, CentOS 7.4 Uninstall the MARIADB database 1. Query the installed MARIADB components
[[email protected]_0_9_centos ~]$ sudo rpm -qa | grep mariadb
mariadb-libs-5.5.60-1.el7_5.x86_64
mariadb-server-5.5.60-1.el7_5.x86_64
mariadb-5.5.60-1.el7_5.x86_64
2. Uninstalling the Database
[[email protected]_0_9_centos ~]$ sudo rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
[[email protected]_0_9_centos ~]$ sudo rpm -aq|grep mariadb
mariadb-server-5.5.60-1.el7_5.x86_64
mariadb-5.5.60-1.el7_5.x86_64
3. Deleting a database file
# Delete other configuration files of the database
[[email protected] _0_9_centos ~] # sudo rm -rf / var / lib / mysql / *
[[email protected] _0_9_centos ~] $ sudo yum -y remove mariadb *
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
-> Running transaction check
---> Package mariadb.x86_64 1: 5.5.60-1.el7_5 will be erased
---> Package mariadb-server.x86_64 1: 5.5.60-1.el7_5 will be erased
-> Finished Dependency Resolution

Dependencies Resolved

======================================================== ======================================================== =======
 Package Arch Version Repository Size
======================================================== ======================================================== =======
Removing:
 mariadb x86_64 1: 5.5.60-1.el7_5 @updates 49 M
 mariadb-server x86_64 1: 5.5.60-1.el7_5 @updates 58 M

Transaction Summary
======================================================== ======================================================== =======
Remove 2 Packages

Installed size: 107 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 4 pre-existing rpmdb problem (s), 'yum check' output follows:
perl-DBD-MySQL-4.023-6.el7.x86_64 has missing requires of libmysqlclient.so.18 () (64bit)
perl-DBD-MySQL-4.023-6.el7.x86_64 has missing requires of libmysqlclient.so.18 (libmysqlclient_18) (64bit)
2: postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18 () (64bit)
2: postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18 (libmysqlclient_18) (64bit)
  Erasing: 1: mariadb-server-5.5.60-1.el7_5.x86_64 1/2
warning: /var/log/mariadb/mariadb.log saved as /var/log/mariadb/mariadb.log.rpmsave
  Erasing: 1: mariadb-5.5.60-1.el7_5.x86_64 2/2
  Verifying: 1: mariadb-server-5.5.60-1.el7_5.x86_64 1/2
  Verifying: 1: mariadb-5.5.60-1.el7_5.x86_64 2/2

Removed:
  mariadb.x86_64 1: 5.5.60-1.el7_5 mariadb-server.x86_64 1: 5.5.60-1.el7_5

Complete!
[[email protected] _0_9_centos ~] $
Second, the CentOS 7.4 installationMariaDB 10.3.9 StableDatabase 1. Add the mariadb yum source
    • 1.1. Create Mariadb.repo
      /etc/yum.repos.d/MariaDB.repocreate it in a file.
[[email protected]_0_9_centos ~]$ sudo vim /etc/yum.repos.d/Mariadb.repo
    • 1.2. Add the fields from the following files to the Mariadb.repo file
    • Use the source of the official website
# MariaDB 10.3 CentOS repository list - created 2018-08-31 07:59 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
Note: Above this is the official online source, but I am greater China ..., you must use the agent, or slow one, with the following the source of Tsinghua is very fast.
    • Using Tsinghua's Source
# MariaDB 10.3 CentOS repository list - created 2018-08-31 07:59 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.3/centos7-amd64/
gpgkey=gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
2.yum Mounting MARIADB
[[email protected]_0_9_centos ~]$ sudo  yum -y install MariaDB-server MariaDB-client
3. Start the MARIADB service
Start MariaDB service
[[email protected] _0_9_centos ~] $ sudo systemctl start mysql.service
Set up boot
[[email protected] _0_9_centos ~] $ sudo systemctl enable mysql.service
Disable boot and restart
[[email protected] _0_9_centos ~] $ sudo systemctl disable mysql.service


Or


systemctl start mariadb.service #Start MariaDB

systemctl stop mariadb.service #Stop MariaDB

systemctl restart mariadb.service #Restart MariaDB

systemctl enable mariadb.service #Set the boot to start
4. Configuring the MARIADB Service
[[email protected]_0_9_centos ~]$ sudo  mysql_secure_installation


[Email protected]_0_9_centos root]$ sudo mysql_secure_installation



Note:running all PARTS of 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 would be blank,
So, should just press ENTER here.
#Since the MariaDB database was initially installed, the default password for the root user is empty, so just press Enter
Enter current password to root (enter for none):
OK, successfully used password, moving on ...





Setting The root password ensures that nobody can log into the MariaDB
Root user without the proper authorisation.
#Whether to set a new password for the root user
Set root Password? [Y / n] Y
#Enter new password
New Password:
#Confirm the new password
Re-enter new password:
Password Updated successfully!
Reloading privilege tables.
... success!





By default, a MariaDB installation have an anonymous user, allowing anyone
To log into MariaDB without has to has a user account created for
them. This was intended only for testing, and the installation
Go a bit smoother. You should remove them before moving into a
Production environment.





#Whether to delete anonymous users, it is recommended to delete in production environment
Remove anonymous users? [Y / n] Y
... success!





Normally, Root should only is allowed to connect from 'localhost'. This
Ensures that someone cannot guess at the root of password from the network.





#Whether root remote login is prohibited, choose according to your needs
Disallow Root login remotely? [Y / n] n
... skipping.





By default, MariaDB comes with a database named 'test' that anyone can
Access. This was also intended only for testing, and should be removed
Before moving into a production environment.





#Whether to delete the test database
Remove test database and access to it? [Y / n] n
... skipping.





Reloading the privilege tables would ensure that all changes made so far
would take effect immediately.





#Whether to reload the permissions table
Reload privilege tables now? [Y / n] Y
... success!



Cleaning up ...



All done! If you ' ve completed all of the above steps, your MariaDB
Installation should now is secure.



Thanks for using mariadb!


specific settings: #Since the MariaDB database was initially installed, the root user default password is empty, so you only need to press ENTER to enter current password for root (enter for none): #Do you want to set the root user's new password Code set root password? (Y / n] y # New password Password: #Confirm new password Re-enter new Password: #Delete anonymous users, production environment recommend removing the Remove anonymous users? [y / n] y # do you want to disable root telnet, choose disallow root login remotely according to your needs? [y/n] n# do you want to delete the test database remove test databases and access to it? [y/n] y# do you want to reload the permissions table reload privilege tables now? [y/n] Y
5. Open remote Access 5.1, firewall add 3306 port
    • View firewall status
[[email protected]_0_9_centos ~]$ sudo firewall-cmd --state

The status is not running, starting Firewall,systemctl start Firewalld.
The status is running, indicating that FIREWALLD has been turned on.

    • Open 3306 Ports
[[email protected]_0_9_centos ~]$ sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
    • Re-loading
[[email protected]_0_9_centos ~]$ sudo firewall-cmd --reload
    • To view all open ports
[[email protected]_0_9_centos ~]$ sudo firewall-cmd --zone=public --list-ports
5.2, open the root to open remote access, to MARIADB assign permissions
    • Enter MARIADB
[[email protected]_0_9_centos ~]$ sudo mysql -uroot -p
    • Select Database
MariaDB [test]> use mysql;
    • Add permissions
MariaDB [mysql]> Grant all on *.* to 'root'@'%' identified by 'root' with grant option;
Query OK, 0 rows affected (0.000 sec)
    • Re-loading
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.000 sec)
Third, the use of mariadb database
    • View the version of MARIADB
MariaDB [mysql]> select version();
+----------------+
| version()      |
+----------------+
| 10.3.9-MariaDB |
+----------------+
1 row in set (0.000 sec)


Reference:


    • Https://www.cnblogs.com/zenghua/p/7149646.html
    • Downloads MARIADB Latest Version
    • Http://www.cnblogs.com/river2005/p/6813618.html
    • 78690743
    • 56015884/


How CentOS 7.4 installs the MariaDB 10.3.9 Stable database


Related Article

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.