日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢(xún)
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
Linux下使用Systemd編譯Mysql5.7.11

Systemd 是 Linux 系統(tǒng)工具,用來(lái)啟動(dòng)守護(hù)進(jìn)程,已成為大多數(shù)發(fā)行版的標(biāo)準(zhǔn)配置,本篇文章重點(diǎn)為大家講解一下Linux下使用Systemd編譯Mysql5.7.11具體方法。

十年建站經(jīng)驗(yàn), 成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作客戶的見(jiàn)證與正確選擇。成都創(chuàng)新互聯(lián)提供完善的營(yíng)銷(xiāo)型網(wǎng)頁(yè)建站明細(xì)報(bào)價(jià)表。后期開(kāi)發(fā)更加便捷高效,我們致力于追求更美、更快、更規(guī)范。

安裝依賴(lài)包

yum -y install make gcc-c++ cmake bison-devel ncurses-devel

下載mysql源碼包

源碼包有兩種版本 : mysql-5.7.11.tar.gz 不帶 boost庫(kù) ,需要自行下載。

mysql-boost-5.7.11.tar.gz 自帶 boost庫(kù),在解壓后的根目錄,推薦下載。 wget http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-5.7.11.tar.gz

curl -O http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-5.7.11.tar.gz

tar -zxf mysql-boost-5.7.11.tar.gz

cd mysql-5.7.11

編譯

生成makefile“

cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DSYSCONFDIR=/etc \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DMYSQL_TCP_PORT=3306 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ [字符集] -DDEFAULT_COLLATION=utf8_general_ci \ [排序規(guī)則 必須有,不然初始化數(shù)據(jù)庫(kù)困難] -DDOWNLOAD_BOOST=1 \ [從MySQL 5.7.5開(kāi)始Boost庫(kù)是必需的] -DWITH_BOOST=/root/mysql-5.7.11/boost \ -DWITH_SYSTEMD=1 [支持Systemd] 加上-DWITH_SYSTEMD=1可以使用systemd控制mysql服務(wù),默認(rèn)是不開(kāi)啟systemd的。

然后 make -j 2 && make install mysql將會(huì)安裝到/usr/local/mysql路徑 慢慢等……

配置MySQL

添加mysql用戶和組

groupadd mysql

useradd -g mysql -s /sbin/nologin mysql

修改/usr/local/mysql權(quán)限

chown -R mysql:mysql /usr/local/mysql

創(chuàng)建 mysql PID 默認(rèn)目錄

在 mysqld.service ,把默認(rèn)的pid文件指定到了 /var/run/mysqld/ 目錄,而并沒(méi)有事先建立該目錄,因此要手動(dòng)建立該目錄并把權(quán)限賦給 mysql 用戶。 mkdir -p /var/run/mysqldchown mysql:mysql /var/run/mysqld

mysql 三個(gè)運(yùn)行文件默認(rèn)位置

log : /var/log/mysqld.logpid : /var/run/mysqld/mysqld.pidsock : /tmp/mysql.sock

拷貝 my.cnf 和 mysqld.service

cp support-files/my-default.cnf /etc/my.cnf

mysql 5.7 默認(rèn)將 mysqld.service (/usr/local/mysql/)文件安裝到了 mysql 安裝目錄下的 usr/lib/systemd/system/,將 mysqld.service 復(fù)制到/usr/lib/systemd/system/目錄下 [root@localhost]/usr/local/mysql#cp usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system

添加環(huán)境變量

— 編輯/etc/profile文件在最后添加如下兩行 — “

vim /etc/profile

PATH=/usr/local/mysql/bin:$PATH export PATH

source /etc/profile

初始化 無(wú)密碼 mysql 數(shù)據(jù)庫(kù)

bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/databin/mysql_ssl_rsa_setup 出現(xiàn)下列內(nèi)容,初始化成功 2016-02-22T03:56:27.254356Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the –initialize-insecure option.

-–initialize 會(huì)生成一個(gè)隨機(jī)密碼(保存在~/.mysql_secret),而 -–initialize-insecure 不會(huì)生成密碼,在MySQL安全配置向?qū)ysql_secure_installation設(shè)置密碼時(shí),可自由選擇 mysql 密碼等級(jí)。

-–datadir目標(biāo)目錄下不能有數(shù)據(jù)文件。

之前版本初始化程序 mysql_install_db 是在 /usr/local/mysql/script 下,并會(huì)在將來(lái)被移除,轉(zhuǎn)而使用mysqld替代 已被廢棄 mysql5.7 放在了 /usr/local/mysql/bin 目錄下。

啟動(dòng) mysql

systemctl start mysqld.service

systemctl status mysqld.service

運(yùn)行 MySQL安全配置向?qū)ysql_secure_installation 設(shè)置密碼,mysql 服務(wù)啟動(dòng)后才可執(zhí)行

a)為root用戶設(shè)置密碼 b)刪除匿名賬號(hào) c)取消root用戶遠(yuǎn)程登錄 d)刪除test庫(kù)和對(duì)test庫(kù)的訪問(wèn)權(quán)限 e)刷新授權(quán)表使修改生效 [root@localhost mysql]# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password. [使用空密碼連接到MySQL]

VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin?[VALIDATE密碼插件可以被用來(lái)測(cè)試密碼 并提高安全性。你是否想設(shè)置VALIDATE密碼插件?]

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy: [有三種級(jí)別的密碼驗(yàn)證策略:]

LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file [最小長(zhǎng)度> = 8 中等長(zhǎng)度> = 8,數(shù)字,大小寫(xiě)混合和特殊字符 最長(zhǎng)長(zhǎng)度> = 8,數(shù)字,混合大小寫(xiě),特殊字符和字典文件]

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 [請(qǐng)輸入0 =低,1 =中2 =強(qiáng):0] Please set the password for root here. [請(qǐng)?jiān)谶@里設(shè)置root用戶的密碼。]

New password: [新密碼:]

Re-enter new password: [重新輸入新密碼:]

Estimated strength of the password: 25 [密碼的估計(jì)強(qiáng)度:25] Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y [您是否希望繼續(xù)與提供的密碼(按y | Y表示是,因?yàn)闆](méi)有任何其他鍵):Y?] … Failed! Error: Your password does not satisfy the current policy requirements [ … 失?。″e(cuò)誤:您的密碼不符合當(dāng)前的要求]

New password:

Re-enter new password:

Estimated strength of the password: 50 [密碼的估計(jì)強(qiáng)度:50] Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL 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. [默認(rèn)情況下,MySQL安裝有一個(gè)匿名用戶, 允許任何人登錄到MySQL.]

Remove anonymous users? (Press y|Y for Yes, any other key for No) : 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. [通常情況下,Root 只允許其進(jìn)行’localhost'(本地) 連接 。]

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n [禁止遠(yuǎn)程root登錄?]

… skipping. […跳過(guò)。] By default, MySQL 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. [默認(rèn)情況下,MySQL帶有一個(gè)名為“測(cè)試”數(shù)據(jù)庫(kù),任何人都可以訪問(wèn)。這也是僅用于測(cè)試,并且應(yīng)該移動(dòng)到生產(chǎn)之前被刪除環(huán)境。]

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n [刪除測(cè)試數(shù)據(jù)庫(kù)和訪問(wèn)權(quán)限?]

… skipping. [ …跳過(guò)。] Reloading the privilege tables will ensure that all changes made so far will take effect immediately. [刷新授權(quán)表以確保所有的變化取得將立即生效。]

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : [現(xiàn)在刷新授權(quán)表?]

… skipping. All done! [全部完成!]

開(kāi)放 Root 遠(yuǎn)程連接權(quán)限

mysql -u root -p
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; [password 為遠(yuǎn)程連接密碼]
mysql>FLUSH PRIVILEGES; [刷新權(quán)限]

分享標(biāo)題:Linux下使用Systemd編譯Mysql5.7.11
本文路徑:http://www.5511xx.com/article/cdioodc.html