溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

怎么使用OEL7.2系統(tǒng)system管理源碼安裝的mysql5.7

發(fā)布時間:2021-11-10 14:24:46 來源:億速云 閱讀:142 作者:iii 欄目:MySQL數(shù)據(jù)庫

這篇文章主要講解了“怎么使用OEL7.2系統(tǒng)system管理源碼安裝的mysql5.7”,文中的講解內(nèi)容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“怎么使用OEL7.2系統(tǒng)system管理源碼安裝的mysql5.7”吧!

1描述
使用OEL7.2系統(tǒng) system 管理源碼安裝的mysql5.7多實例.
2操作環(huán)境
2.1OS info
OEL7.2 x64
3過程設計
編輯/etc/my.cnf ,本文創(chuàng)建mysqld@3307.service與mysqld@3308.service兩個實例,分別對應3307與3308端口。創(chuàng)建相應實例目錄。
復制systemd 服務文件,復制mysql base目錄下/usr/local/mysql/usr/lib/systemd/system/的mysqld@.service文件到系統(tǒng)/usr/lib/systemd/system目錄下,并重命名成與多實例名一致的文件。
systemctl daemon-reload
systemctl start mysqld@3307.service
systemctl start mysqld@.service3308
4詳細步驟操作
[root@localhost ~]# vi /etc/my.cnf
[root@localhost ~]# cat !$
cat /etc/my.cnf
[mysqld@3307]
datadir=/usr/local/mysql/data/3307
socket=/usr/local/mysql/data/3307/mysql.sock
port=3307
log-error=/var/log/mysqld-service3307.log
[mysqld@3308]
datadir=/usr/local/mysql/data/3308
socket=/usr/local/mysql/data/3308/mysql.sock
port=3308
log-error=/var/log/mysqld-service3308.log
[root@localhost ~]# mkdir -p /usr/local/mysql/data/3307
[root@localhost ~]# mkdir -p /usr/local/mysql/data/3308
[root@localhost ~]# chown -R mysql.mysql /usr/local/mysql/data/
[root@localhost ~]# cd /usr/lib/systemd/system
[root@localhost system]# ls -l mysqld*
-rw-r--r--. 1 root root 1637 May  3 03:07 mysqld.service
-rw-r--r--. 1 root root 1668 May  3 03:07 mysqld@.service
[root@localhost system]# cp mysqld@.service mysqld@3307
[root@localhost system]# cp mysqld@.service mysqld@3308
[root@localhost system]# systemctl daemon-reload
[root@localhost system]# mkdir /var/run/mysqld/
[root@localhost system]# chown -R mysql.mysql /var/run/mysqld
[root@localhost system]# cd /var/log/
[root@localhost log]# ls -lrt|tail
-rw-r--r--. 1 root  root    8460 May  8 01:20 boot.log
-rw-------. 1 root  root    1739 May  8 01:20 cron
-rw-r--r--. 1 root  root     360 May  8 01:20 wpa_supplicant.log
-rw-------. 1 root  root     594 May  8 01:20 maillog
-rw-rw-r--. 1 root  utmp   22656 May  8 01:21 wtmp
-rw-r--r--. 1 root  root  291416 May  8 01:21 lastlog
-rw-r-----. 1 mysql mysql   4377 May  8 01:24 mysqld-service3307.log
-rw-r-----. 1 mysql mysql   4449 May  8 01:24 mysqld-service3308.log
-rw-------. 1 root  root  540273 May  8 01:24 messages
-rw-------. 1 root  root    7764 May  8 01:24 secure
[root@localhost log]# grep password mysqld-service3307.log
2018-05-07T17:24:01.123362Z 1 [Note] A temporary password is generated for root@localhost: x&aQ/IT&p5%u
[root@localhost log]# grep password mysqld-service3308.log
2018-05-07T17:24:17.635837Z 1 [Note] A temporary password is generated for root@localhost: xt2aq-KYGWnt
[root@localhost log]# /usr/local/mysql/bin/mysql -uroot -p'x&aQ/IT&p5%u' -S /usr/local/mysql/data/3307/mysql.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.22
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> exit
Bye
[root@localhost log]# /usr/local/mysql/bin/mysql -uroot -p'xt2aq-KYGWnt' -S /usr/local/mysql/data/3308/mysql.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.22
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> exit
Bye
[root@localhost log]#
[root@localhost log]# systemctl stop mysqld@330*
[root@localhost log]# ps -ef |grep mysql
root       3328   2861  0 01:32 pts/0    00:00:00 grep --color=auto mysql
[root@localhost log]# systemctl start mysqld@330*
[root@localhost log]# ps -ef |grep mysql
root       3335   2861  0 01:32 pts/0    00:00:00 grep --color=auto mysql
[root@localhost log]# systemctl start mysqld@330*
[root@localhost log]# systemctl start mysqld@3307
[root@localhost log]# systemctl start mysqld@3308
[root@localhost log]# ps -ef |grep mysql
mysql      3367      1  5 01:32 ?        00:00:00 /usr/local/mysql/bin/mysqld --defaults-group-suffix=@3307 --daemonize --pid-file=/var/run/mysqld/mysqld-3307.pid
mysql      3420      1 10 01:32 ?        00:00:00 /usr/local/mysql/bin/mysqld --defaults-group-suffix=@3308 --daemonize --pid-file=/var/run/mysqld/mysqld-3308.pid
root       3449   2861  0 01:32 pts/0    00:00:00 grep --color=auto mysql
[root@localhost log]# systemctl stop mysqld@330*
[root@localhost log]# ps -ef |grep mysql
root       3459   2861  0 01:32 pts/0    00:00:00 grep --color=auto mysql
[root@localhost log]# systemctl start mysqld@330*
[root@localhost log]# ps -ef |grep mysql
root       3466   2861  0 01:33 pts/0    00:00:00 grep --color=auto mysql
[root@localhost log]#

感謝各位的閱讀,以上就是“怎么使用OEL7.2系統(tǒng)system管理源碼安裝的mysql5.7”的內(nèi)容了,經(jīng)過本文的學習后,相信大家對怎么使用OEL7.2系統(tǒng)system管理源碼安裝的mysql5.7這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI