Centos下MySQL Mariadb 的安裝

2021-09-02 18:50:17 字數 2975 閱讀 7226

因為centos預設的資料庫是mariadb,所以安裝很簡單,只需要使用yum安裝即可。

[root@bogon ~]# yum -y install mariadb-server mariadb

[root@bogon ~]# rpm -qi mariadb #檢視是否安裝成功

解釋:mariadb只是client客戶端,mariadb-server才是mariadb的後台資料庫。

還有一點,在centos中,執行yum -y install mysql mysql-server其實安裝的是mariadb。

啟動mariadb並加入開機自啟

[root@bogon ~]# systemctl start mariadb

[root@bogon ~]# systemctl enable mariadb

created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

[root@bogon ~]#

登入mariadb。

首次安裝,mariadb的密碼預設為空,所以輸密碼時直接敲回車就行。還有一點要注意:mariadb的命令和mysql的命令幾乎一模一樣。

[root@bogon ~]# mysql

welcometothe mariadb monitor. commandsendwith;or\g.

your mariadb connection idis9

server version: 5.5.60-mariadb mariadb server

others.

type'help;'

or'\h'

forhelp.type'\c'

toclear the current input statement.

mariadb [(none)]>

首先檢視是否安裝了mariadb

[root@bogon ~]#rpm-qmariadb

mariadb-5.5

.60-1

.el7_5

.x86_64

[root@bogon ~]#

若安裝了,解除安裝掉

[root@bogon ~]# rpm -q mariadb
接下來安裝mysql

[root@bogon ~]# wgetcom/get/mysql57-community-release-el7-11.noarch.rpm
安裝mysql的rpm包

[root@bogon ~]#rpm-ivhmysql57-community-release-el7-11.noarch

.rpm

檢視是否安裝成功

[root@bogon~]# rpm -q mysql57-community-release

mysql57-community-release-el7

-11.noarch

安裝mysql

[root@bogon ~]# yum -y install mysql-server
現在執行這條命令安裝的才是mysql,不是mariadb

啟動mysql並加入開機自啟

[root@localhost ~]# systemctl start mysqld

[root@localhost ~]# systemctl enabl mysqld

登入mysql。和mariadb一樣,首次登入密碼預設為空

[root@localhost ~]# mysql

welcome to the mysql monitor. commands end with ;or \g.

your mysql connection id is 2

server version: 5.7.24 mysql community server (gpl)

oracle is a registered trademark of oracle corporationand/or its

affiliates. other names may be trademarks of their respective

owners.

type 'help;'or '\h' for help. type '\c' to clear the current input statement.

mysql>

ok,mysql|mariadb的安裝就完成了。

centOS下解除安裝samba

1 首先檢查samba服務包,輸入命令 rpm qa grep samba,會出現下面兩到三個包 samba common 2.2.7a 7.9.0.i386 伺服器和客戶端均需要的檔案 samba 2.2.7a 7.9.0.i386 伺服器端檔案 samba client 2.27a 7.9.0....

centos下刪除軟體

要知道安裝了哪些元件,通過命令 rpm qa grep qt root lala download rpm qa grep qt ibus qt 1.3.0 2.el6.i686 qt 4.6.2 26.el6 4.i686 qt devel 4.6.2 26.el6 4.i686 qt x11 4...

CentOS下安裝linux kernel原始碼

1.centos下安裝linux kernel的原始碼 以root使用者進行以下操作 yum install rpm build yum install redhat rpm config lynx rpm ivh kernel 2.6.32 71.el6.src.rpm 3.執行rpmbuild命...