在CentOS7下安裝並使用MariaDB數據庫

一、查詢MariaDB包mysql

[root@test ~]# yum list all | grep mariadb

二、安裝mariaDBsql

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

三、配置mariaDB數據庫

[root@test ~]# systemctl start mariadb         #啓動MariaDB
[root@test ~]# systemctl enable mariadb        #設置MariaDB爲開機自啓動
[root@test ~]# netstat -ntlp              #查看3306端口是否成功啓動
[root@test ~]# mysql_secure_installation        #首次安裝須要進行數據庫的配置

Enter current password for root (enter for none):  # 輸入數據庫超級管理員root的密碼(注意不是系統root的密碼),第一次進入尚未設置密碼則直接回車
Set root password? [Y/n]  # 設置密碼,y
New password:  # 新密碼
Re-enter new password:  # 再次輸入密碼
Remove anonymous users? [Y/n]  # 移除匿名用戶, y
Disallow root login remotely? [Y/n]  # 拒絕root遠程登陸,y
Remove test database and access to it? [Y/n]  # 刪除test數據庫,y:刪除。n:不刪除,數據庫中會有一個test數據庫,通常不須要
Reload privilege tables now? [Y/n]  # 從新加載權限表,y。或者重啓服務也許

四、登陸測試mariaDBbash

[root@test ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (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)]>
MariaDB [(none)]>quit
相關文章
相關標籤/搜索