您好,登錄后才能下訂單哦!
小編給大家分享一下Linux下如何安裝數(shù)據(jù)庫(kù)管理系統(tǒng)MariaDB,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
MariaDB數(shù)據(jù)庫(kù)管理系統(tǒng)是 MySQL 的一個(gè)分支,主要由開源社區(qū)在維護(hù),采用GPL授權(quán)許可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能輕松成為MySQL的代替品。
yum install mariadb-server mariadb -y
查看版本
[root@mysqldb ~]# rpm -q mariadb-server mariadbmariadb-server-5.5.60-1.el7_5.x86_64 mariadb-5.5.60-1.el7_5.x86_64
[root@mysqldb ~]# systemctl enable mariadbCreated symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
安裝完后,root密碼默認(rèn)是空,因此需要進(jìn)行配置安全控制程序。
配置前需要先啟動(dòng)mariadb
systemctl start mariadb
啟動(dòng)安全配置程序
[root@mysqldb ~]# mysql_secure_installationNOTE: 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密碼,這里進(jìn)行設(shè)置 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 #允許root遠(yuǎn)程登陸數(shù)據(jù)庫(kù) ... 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] n #不刪除test數(shù)據(jù)庫(kù),后面測(cè)試可以使用 ... skipping. 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!
按照上面的提示進(jìn)行配置,大致就ok了。
上面已經(jīng)設(shè)置了密碼,因此不能只通過mysql就登陸數(shù)據(jù)庫(kù),后面必須加上用戶和密碼。
[root@mysqldb ~]# mysql -u root -pEnter password: #輸出密碼,不建議放在-p后面明文顯示W(wǎng)elcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 9 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)]>
查看數(shù)據(jù)庫(kù)
show databases;
進(jìn)入數(shù)據(jù)庫(kù)
use mysql;
查看表列表
show tables;
查看表結(jié)構(gòu)
desc user;
查看版本:
MariaDB [mysql]> select version(); +----------------+ | version() | +----------------+ | 5.5.60-MariaDB | +----------------+ 1 row in set (0.00 sec)
目錄 | 說明 |
---|---|
/var/lib/mysql | mysql數(shù)據(jù)文件存放路徑,可以自定義 |
/etc/my.cnf | mysql配置文件地址 |
/usr/lib64/mysql | mysql庫(kù)文件路徑 |
/usr/bin/mysql* | mysql二進(jìn)制可執(zhí)行文件路徑 |
/etc/rc.d/init.d/mysqld | mysql服務(wù)管理腳本地址 |
/var/log/mysqld.log | mysql日志文件地址 |
以上是“Linux下如何安裝數(shù)據(jù)庫(kù)管理系統(tǒng)MariaDB”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。