這篇文章主要介紹“如何使用二進(jìn)制包來(lái)安裝MySQL”,在日常操作中,相信很多人在如何使用二進(jìn)制包來(lái)安裝MySQL問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”如何使用二進(jìn)制包來(lái)安裝MySQL”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!
重要提示:
MySQL需要安裝libaio,5.7.19版本及以后需要libnuma
1 解壓MySQL到指定的路徑,這一步將創(chuàng)建如下的目錄結(jié)構(gòu):
參考解壓指令:
gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
Table 2.3 MySQL Installation Layout for Generic Unix/Linux Binary Package
Directory | Contents of Directory |
bin | mysqld server, client and utility programs |
docs | MySQL manual in Info format |
man | Unix manual pages |
include | Include (header) files |
lib | Libraries |
share | Error messages, dictionary, and SQL for database installation |
support-files | Miscellaneous support files |
2 創(chuàng)建用戶(hù)和組
此用戶(hù)和組用于運(yùn)行mysqld,
shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql #-r means create a system account
3 創(chuàng)建符號(hào)鏈接
shell> ln -s full-path-to-mysql-VERSION-OS mysql
4 指定到Path環(huán)境變量
export PATH=$PATH:/usr/local/mysql/bin
5 初始化數(shù)據(jù)文件路徑
在mysql安裝路徑中創(chuàng)建mysql-files文件夾,用于指向 secure_file_priv 參數(shù),用于導(dǎo)入/導(dǎo)出文件
shell> mkdir mysql-files
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files
shell> bin/mysqld --initialize --user=mysql
執(zhí)行initialize命令時(shí),一定要注意,data-directory的owner一定是mysql,然后注意在initialize后面加上--user=mysql
如果mysql無(wú)法知道basedir(安裝路徑)或者 datadir 數(shù)據(jù)文件路徑時(shí),使用一些進(jìn)行指定。
shell> bin/mysqld --initialize --user=mysql --basedir=/opt/mysql/mysql --datadir=/opt/mysql/mysql/data
當(dāng)然,也可以寫(xiě)入到my.cnf路徑中
[mysqld]
basedir=/opt/mysql/mysql
datadir=/opt/mysql/mysql/data
使用方法如下
C:\> bin/mysqld --defaults-file=C:\my.ini --initialize
初始化data目錄后,啟動(dòng)mysql
bin/mysqld_safe --user=mysql &
然后登錄后,即完成mysql的安裝工作。
到此,關(guān)于“如何使用二進(jìn)制包來(lái)安裝MySQL”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!
分享文章:如何使用二進(jìn)制包來(lái)安裝MySQL-創(chuàng)新互聯(lián)
本文地址:http://chinadenli.net/article36/dhjgpg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、移動(dòng)網(wǎng)站建設(shè)、ChatGPT、自適應(yīng)網(wǎng)站、微信小程序、做網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容