CentOS 7.4 How to install the MariaDB 10.3.9 Stable database

Source: Internet
Author: User

Tags: Nobody add iss ISA MySQL enc boot up lov rpm-e

How to install CentOS 7.4 MariaDB 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 mariadbmariadb-libs-5.5.60-1.el7_5.x86_64mariadb-server-5.5.60-1.el7_5.x86_64mariadb-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 mariadbmariadb-server-5.5.60-1.el7_5.x86_64mariadb-5.5.60-1.el7_5.x86_64
3. Deleting a database file
# Remove other configuration files from 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, langpacksresolving dependencies--> Running Transaction ch Eck---> Package mariadb.x86_64 1:5.5.60-1.el7_5 'll be a erased---> Package mariadb-server.x86_64 1:5.5.60-1.el7_5 'll be erased--> finished Dependency resolutiondependencies resolved============================================                       =============================================================== Package Arch Version Repository size=========================================================================== ================================REMOVING:MARIADB x86_64 1:5.5.60-1.el7_5 @u               Pdates M mariadb-server x86_64 1:5.5.60-1.el7_5 @updates Mtransaction summary===========================================================================================================remove 2 packagesinstalled size:107 mdownloading packages:running transaction checkrunning transaction testtransaction test Succeededrunning Transactionwarning:rpmdb altered outside of yum.** Found 4 pre-existing Rpmdb problem (s), ' yum check ' ou Tput 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 have                                                  Missing requires of libmysqlclient.so.18 (LIBMYSQLCLIENT_18) (64bit) erasing:1:mariadb-server-5.5.60-1.el7_5.x86_64 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 2/2 verifying:1:mariadb-5.5.60-1.el7_5.x86_64 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 installation MariaDB 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 = MariaDBbaseurl = http://yum.mariadb.org/10.3/centos7-amd64gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDBgpgcheck=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 = MariaDBbaseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.3/centos7-amd64/gpgkey=gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDBgpgcheck=1
2.yum Mounting MARIADB
[[email protected]_0_9_centos ~]$ sudo  yum -y install MariaDB-server MariaDB-client
3. Start the MARIADB service
启动MariaDB服务[[email protected]_0_9_centos ~]$ sudo systemctl start mysql.service设置开机启动[[email protected]_0_9_centos ~]$ sudo systemctl enable mysql.service禁止开机重启[[email protected]_0_9_centos ~]$ sudo systemctl disable mysql.service


systemctl start mariadb.service #启动MariaDBsystemctl stop mariadb.service #停止MariaDBsystemctl restart mariadb.service #重启MariaDBsystemctl enable mariadb.service #设置开机启动
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.
#由于一开始安装MariaDB数据库后, root用户默认密码为空, 所以只需要按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.
Set root Password? [y/n] Y
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.

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.

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.

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.

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: #由于一开始安装MariaDB数据库后, the root user default password is empty, so you only need to press ENTER to enter current password for root (enter for none): #是否设置root用户的新密 Code set root password? [y/n] y# New password Password: #确认新密码Re-enter new Password: #是否删除匿名用户, 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)


    • 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

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.

Tags Index: