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)限

- 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)密碼是隱藏的)
