CentOS7升级MariaDB 10.2版本详细步骤
生活随笔
收集整理的這篇文章主要介紹了
CentOS7升级MariaDB 10.2版本详细步骤
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
#查看mariadb運行狀態: systemctl status mariadb
#啟動mariadb: systemctl start mariadb
#停止mariadb :systemctl stop mariadb
#重新啟動 :systemctl restart mariadb
#開機啟動: systemctl enable mariadb?1、查看sql版本:# mysql --version
mysql Ver 15.1 Distrib 5.5.64-MariaDB, for Linux (x86_64) using readline 5.12、查看使用狀態:# systemctl status mariadb3、查看自帶安裝信息:# rpm -qa | grep -i mariadb
mariadb-5.5.64-1.el7.x86_64
mariadb-server-5.5.64-1.el7.x86_64
mariadb-libs-5.5.64-1.el7.x86_64
4、查看自帶安裝信息:# yum list|grep mariadb
mariadb.x86_64 1:5.5.64-1.el7 @os
mariadb-libs.x86_64 1:5.5.64-1.el7 @os
mariadb-server.x86_64 1:5.5.64-1.el7 @os
mariadb-bench.x86_64 1:5.5.64-1.el7 os
mariadb-devel.i686 1:5.5.64-1.el7 os
mariadb-devel.x86_64 1:5.5.64-1.el7 os
mariadb-embedded.i686 1:5.5.64-1.el7 os
mariadb-embedded.x86_64 1:5.5.64-1.el7 os
mariadb-embedded-devel.i686 1:5.5.64-1.el7 os
mariadb-embedded-devel.x86_64 1:5.5.64-1.el7 os
mariadb-libs.i686 1:5.5.64-1.el7 os
mariadb-test.x86_64 1:5.5.64-1.el7 os5、停止服務運行并查看:# systemctl stop mariadb && systemctl status mariadb
6、開始卸載# yum remove -y mariadb && yum remove -y mariadb-*
7、#已搜不到安裝信息
# yum list installed |grep mariadb
# rpm -qa|grep mariadb
# find / -name mysql
/var/lib/mysql
/usr/lib64/mysql
# rm -rf /var/lib/mysql/
# rm -rf /var/lib64/mysql/
# find / -name mariadb
/var/log/mariadb
# rm -rf /var/log/mariadb
8、配置yum源為國內地址:# vim /etc/yum.repos.d/Mariadb.repo
錄入以下內容
[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.2/centos7-amd64
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
9、清除yum源緩存數據,并生成新的yum源數據緩存
# yum clean all && yum makecache all
10、查看下載緩存信息
# ll /var/cache/yum/x86_64/7/mariadb
12、開始安裝
# yum install MariaDB-server MariaDB-client -y
....
已安裝:MariaDB-client.x86_64 0:10.2.31-1.el7.centos MariaDB-server.x86_64 0:10.2.31-1.el7.centos作為依賴被安裝:MariaDB-common.x86_64 0:10.2.31-1.el7.centos MariaDB-compat.x86_64 0:10.2.31-1.el7.centos boost-program-options.x86_64 0:1.53.0-27.el7galera.x86_64 0:25.3.28-1.rhel7.el7.centos完畢!
13、啟動mariadb
# systemctl start mariadb.service
14、初始化配置信息(設置root密碼)
# /usr/bin/mysql_secure_installationNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDBSERVERS 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 will be blank,
so you should just press enter here.Enter current password for 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 has an anonymous user, allowing anyone
to log into MariaDB without having to have a user 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... Success!Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root 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 is also intended only for testing, and should be removed
before moving into a production environment.Remove test database and access to it? [Y/n] y- Dropping test database...... Success!- Removing privileges on test database...... Success!Reloading the privilege tables will ensure that all changes made so far
will 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 be secure.Thanks for using MariaDB!
安裝完成
15、創建初始化數據庫(創建數據庫如下圖)
# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 20
Server version: 10.2.31-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]>
mysql> use mysql;
mysql> CREATE USER 'glpi'@'%' IDENTIFIED BY 'glpi'; #用戶名 密碼
mysql> GRANT USAGE ON *.* TO 'glpi'@'%' IDENTIFIED BY 'glpi';
mysql> create database glpi;
mysql>grant select,insert,update,delete,create,drop on glpi.* to 'glpi'@'%';
mysql> quit
16、#重新啟動 :systemctl restart mariadb
17、#開機啟動: systemctl enable mariadb?
總結
以上是生活随笔為你收集整理的CentOS7升级MariaDB 10.2版本详细步骤的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 栈的逆置
- 下一篇: ctf php正则截断,记[BJDCTF