yum安裝Mariadb,二進制安裝Mariadb

yum安裝Mariadb

設置Mariadb的yum源

vim /etc/yum.repos.d/mariadb.repo  
[mariadb]
name=mariadb
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum/10.2/centos7-amd64/
gpgcheck=0

使用清華yum源安裝Mariadb,可以選擇不同的版本,此處安裝10.2.23
yum install mariadb-server

二進制安裝Mariadb

1 準備mysql用戶和組

groupadd -r -g 336 mysql      #創建mysql組
useradd -r -g mysql -u 336 -s /sbin/nologin -d /data/mysql mysql  #創建mysql用戶,并加入mysql用戶組,設置UID為336,設置默認shell為nologoin,家目錄為/data/mysql 但不自動創建

2 準備二進制程序文件和相關文件屬性

tar xvf mariadb-10.2.23-linux-x86_64.tar.gz -C /usr/local   #只能放在此目錄中
cd /usr/local/
ln -s mariadb-10.2.23-linux-x86_64/ mysql                   #建立軟件鏈接,方便使用
chown -R root.root /usr/local/mysql/                        #設置屬主和屬組為root用戶和root組

3 PATH變量

vim /etc/profile.d/mysql.sh
PATH=/usr/local/mysql/bin:$PATH
. /etc/profile.d/mysql.sh

4 準備數據庫數據目錄和數據(使用邏輯卷)

創建邏輯卷
pvcreate /dev/sda6
創建卷組
vgcreate vg0 /dev/sda6
創建邏輯卷
lvcreate -n mysql -L 20G /dev/vg0
創建文件系統并掛載到/data/mysql
mkfs.xfs /dev/vg0/mysql
mkdir /data/mysql
mount /dev/vg0/mysql /data/mysql
chown mysql.mysql /data/mysql/
cd /usr/local/mysql
./scripts/mysql_install_db --datadir=/data/mysql --user=mysql #安裝mysql到/data/mysql目錄下,用戶為mysql

5 準備Mysql的服務器端配置文件

mkdir /etc/mysql  
cp /usr/local/mysql/support-files/my-huge.cnf /etc/mysql/my.cnf  
vim /etc/mysql/my.cnf  
[mysqld]
datadir=/data/mysql   #設置目錄為/data/mysql

6 準備服務啟動腳本

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
service mysqld start

7 安全加固

[root@Centos7 ~]#/usr/bin/mysql_secure_installationNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDBSERVERS 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     #設置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遠程登錄... 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- 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  #重新加載權限表... 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!

8 測試連接
mysql -uroot -pPASSWORD

轉載于:https://blog.51cto.com/13749470/2385769

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/275248.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/275248.shtml
英文地址,請注明出處:http://en.pswp.cn/news/275248.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Oracle中的wmsys.wm_concat

Oracle中的wmsys.wm_concat主要實現行轉列功能(說白了就是將查詢的某一列值使用逗號進行隔開拼接,成為一條數據)。 wmsys.wm_concat除了單獨使用外還可以和over函數結合使用。 開始看看具體使用方法: select t.rank, t.Name from t_menu_item t; rank…

Github 王炸功能!Copilot 替代打工人編程?

大家好,我是若川。最近組織了源碼共讀活動,感興趣的可以加我微信 ruochuan12 參與,已進行三個月了,大家一起交流學習,共同進步。大家好,我是皮湯。最近組里在討論一個有意思的工具 Github Copilot&#xff…

ux和ui_糟糕的UI與UX番茄醬模因

ux和uiAt face value, this meme appears to be a quick and easy tool for educating the general public about what the differences are between UI and UX. You might look at the attractive glass bottle labeled “UI” and understand that UI might have to do more …

Linux中的wheel用戶組是什么?

在Linux中wheel組就類似于一個管理員的組。 通常在Linux下,即使我們有系統管理員root的權限,也不推薦用root用戶登錄。一般情況下用普通用戶登錄就可以了,在需要root權限執行一些操作時,再su登錄成為root用戶。但是,任…

ElementUI 組件庫 md-loader 的解析和優化

大家好,我是若川。最近組織了源碼共讀活動,感興趣的可以加我微信 ruochuan12 參與,已進行三個月了,大家一起交流學習,共同進步。背景相信很多同學在學習 webpack 的時候,對 loader 的概念應該有所了解&…

一個html5流星雨源碼

流星會隨著鼠標的方向劃過&#xff0c;按緊鼠標左鍵可以增長流星的尾巴。 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang"zh-CN"> <head> <title>流星雨<…

csdn 用戶 螞蟻翹大象_用戶界面設計師房間里的大象

csdn 用戶 螞蟻翹大象Once upon a time, an educated eye detected a new trend in UI designs, particularly, in Dribbble. It was a conceptual proposition, not an actual design for a customer or an app. Trying to explain the characteristics of this new trend, a …

面試官問發布訂閱模式是在問什么?

大家好&#xff0c;我是若川。最近組織了源碼共讀活動&#xff0c;感興趣的可以加我微信 ruochuan12 參與&#xff0c;已進行了三個多月&#xff0c;大家一起交流學習&#xff0c;共同進步。本文來自 simonezhou 小姐姐投稿的第八期筆記。面試官常問發布訂閱、觀察者模式&#…

linux服務器內存、根目錄使用率、某進程的監控告警腳本

腳本內容如下 #!/bin/bash#磁盤超過百分之80發送郵件告警DISK_USEDdf -T |sed -n "2p" |awk {print ($4/$3)*100}DISK_percentage80if [ expr "$DISK_USED > $DISK_percentage" ]thenecho "$HOSTNAME服務器當前硬盤使用率為$DISK_USED%" | ma…

figma下載_不用擔心Figma中的間距

figma下載重點 (Top highlight)I spend way too much time caring about spacing when designing interfaces and building design systems. You are probably no stranger to the constant 1 px and 8 px nudging, continuous checking of the bottom or in-between space for…

【建議收藏】面試官賊喜歡問的 32+ vue 修飾符,你掌握幾種啦?

大家好&#xff0c;我是若川。最近組織了源碼共讀活動&#xff0c;感興趣的可以加我微信 ruochuan12 參與&#xff0c;已進行了三個多月&#xff0c;大家一起交流學習&#xff0c;共同進步。前言vue簡潔好用體現在很多個地方&#xff0c;比如其內置了32修飾符&#xff0c;可以很…

知識管理系統Data Solution研發日記之一 場景設計與需求列出

在平時開發的過程中&#xff0c;經常會查找一些資料&#xff0c;從網上下載一些網頁&#xff0c;壓縮格式文件到自己的電腦中&#xff0c;然后閱讀。程序有別于其他行業的一個特征是&#xff0c;所有的資料&#xff0c;數據&#xff0c;壓縮文件&#xff0c;只用于產生可以工作…

系列TCP/IP協議-動態IP選路協議(008)

一、引言 前一章已經說過了IP數據包是如何分發的。為啥這一章還要說這個問題&#xff1f;在網絡很小、只有單個連接點、沒有多余的路由的時候&#xff0c;使用靜態選路是可以的。但是一旦網絡變大一點就會出現各種問題。在大網絡中的網絡選路將在該節說明。 ??動態選路協議用…

shields 徽標_我們如何準確地記住著名徽標的特征和顏色?

shields 徽標The logos of global corporations like Apple, Starbucks, Adidas, and IKEA are designed to create instant brand associations in the minds of billions who see them every day. But how accurately can we remember the features and colors of these famo…

面了三次字節,他的一些感悟

大家好&#xff0c;我是若川。最近組織了源碼共讀活動&#xff0c;感興趣的可以加我微信 ruochuan12 參與&#xff0c;已進行了三個多月&#xff0c;大家一起交流學習&#xff0c;共同進步。今天分享一篇小K投稿的字節面試記錄&#xff0c;這是他第三次面字節了&#xff0c;之前…

JavaScript數組內置排序函數

javascript內置的sort函數是多種排序算法的集合 JavaScript實現多維數組、對象數組排序&#xff0c;其實用的就是原生的sort()方法&#xff0c;用于對數組的元素進行排序。 sort() 方法用于對數組的元素進行排序。語法如下&#xff1a; ArrayObject.sort(order); 測試A&#xf…

解決Wireshark安裝Npcap組件失敗

2019獨角獸企業重金招聘Python工程師標準>>> 解決Wireshark安裝Npcap組件失敗 從Wireshark 3.0開始&#xff0c;Npcap取代Winpcap組件&#xff0c;成為Wireshark默認的網卡核心驅動。由于該組件屬于驅動程序&#xff0c;所以安裝時候容易被殺毒/防火墻軟件攔截&…

adobe清理工具_Adobe終于通過其新的漸變工具實現了這一點-UX評論

adobe清理工具的Photoshop (Photoshop) UX:用戶體驗&#xff1a; At first glance, the UX looks okay; it’s pretty clear. The user gets to know how to use this tool right away. The color palette is located above, and the gradient down below. The diamond betwee…

GMF學習系列(二) 一些知識點(續2)

8.插件的國際化&#xff0c;可以參考nwpu.cdcsp.sbpel.diagram.part中messages.java的做法。 9.Text自動提示功能 import org.eclipse.jface.bindings.keys.KeyStroke; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.fieldassist.AutoCompleteField; im…

新手向:前端程序員必學基本技能——調試JS代碼

1前言大家好&#xff0c;我是若川。最近組織了源碼共讀活動&#xff0c;感興趣的可以加我微信 ruochuan12 參與&#xff0c;已進行三個月了&#xff0c;大家一起交流學習&#xff0c;共同進步。想學源碼&#xff0c;極力推薦之前我寫的《學習源碼整體架構系列》 包含jQuery、un…