Linux安裝MariaDB數(shù)據(jù)庫(kù)

1.下載MariaDB數(shù)據(jù)庫(kù)

先測(cè)試是否能連接到網(wǎng)絡(luò): ping www.baidu.com


安裝命令: 安裝數(shù)據(jù)庫(kù)
[root@localhost src]# yum install mariadb-server //安裝mariadb數(shù)據(jù)庫(kù)
[root@localhost src]# yum clean all //清空已安裝文件 如果下載失敗之后執(zhí)行的.

安裝成功提示:


數(shù)據(jù)庫(kù)啟動(dòng)命令: 啟動(dòng)數(shù)據(jù)庫(kù)
1. 啟動(dòng)命令 [root@localhost src]# systemctl start mariadb
2. 重啟命令 [root@localhost src]# systemctl restart mariadb
3. 關(guān)閉命令 [root@localhost src]# systemctl stop mariadb
4. 設(shè)定開(kāi)機(jī)自起 [root@localhost src]# systemctl enable mariadb
5. 關(guān)閉開(kāi)機(jī)自起 [root@localhost src]# systemctl disable mariadb

數(shù)據(jù)庫(kù)初始化命令: mysql_secure_installation
初始化數(shù)據(jù)庫(kù):

[root@localhost ~]  mysql_secure_installation
  
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS 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 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    #設(shè)置root密碼  
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] y    #禁止root遠(yuǎn)程登錄
 ... Success!
  
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    #刪除test數(shù)據(jù)庫(kù)和對(duì)此數(shù)據(jù)庫(kù)的訪問(wèn)權(quán)限
![20200907165746693.png](https://upload-images.jianshu.io/upload_images/26545924-ffe6f20405b4b60e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
 - 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    #立即刷新權(quán)限
 ... 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!

登錄數(shù)據(jù)庫(kù): 注意!(linux系統(tǒng)密碼是隱藏的)


?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容