成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

Mysql多實(shí)例如何安裝配置

這篇文章主要為大家展示了“MySQL多實(shí)例如何安裝配置”,內(nèi)容簡(jiǎn)而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“Mysql多實(shí)例如何安裝配置”這篇文章吧。

成都創(chuàng)新互聯(lián)專注于城關(guān)企業(yè)網(wǎng)站建設(shè),成都響應(yīng)式網(wǎng)站建設(shè),電子商務(wù)商城網(wǎng)站建設(shè)。城關(guān)網(wǎng)站建設(shè)公司,為城關(guān)等地區(qū)提供建站服務(wù)。全流程定制設(shè)計(jì),專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,成都創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)

1.OS用戶創(chuàng)建/軟件解壓/OS權(quán)限配置

點(diǎn)擊(此處)折疊或打開(kāi)

  1. [root@wbg software]# groupadd mysql

  2. [root@wbg software]# useradd -r -g mysql -s /bin/false mysql

  3. [root@wbg software]# cd /usr/local

  4. [root@wbg local]# tar zxvf ~/software/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz

  5. 解壓中。。。

  6. [root@wbg local]# ln -s mysql-5.7.18-linux-glibc2.5-x86_64/ mysql

  7. [root@wbg mysql]# mkdir mysql-files

  8. [root@wbg mysql]# chmod 750 mysql-files

  9. [root@wbg mysql]# chown -R mysql .

  10. [root@wbg mysql]# chgrp -R mysql .

2.編寫(xiě)/etc/my.cnf

點(diǎn)擊(此處)折疊或打開(kāi)

  1. [mysqld_multi]

  2. mysqld = /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysqld_safe

  3. mysqladmin = /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysqladmin

  4. user = root

  5. password = gg

  6. log     =/root/multi.log

  7. [mysqld3306]

  8. socket = /tmp/mysql.sock3306

  9. port = 3306

  10. pid-file = /mydata/3306/hostname.pid.3306

  11. datadir = /mydata/3306/

  12. #language = /usr/local/mysql/share/mysql/english

  13. user = mysql

  14. [mysqld3308]

  15. mysqld = /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysqld_safe

  16. #ledir = /path/to/mysqld-binary/

  17. mysqladmin = /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysqladmin

  18. socket = /tmp/mysql.sock3308

  19. port = 3308

  20. pid-file = /mydata/3308/hostname.pid.3308

  21. datadir = /mydata/3308/

  22. #language = /usr/local/mysql/share/mysql/swedish

  23. user = mysql

  24. [client]

  25. #port=3306

  26. #socket=/tmp/mysql.sock3306

  27. #port=3308

  28. #socket=/tmp/mysql.sock3308

我用的是官方的模板來(lái)做的,用的參數(shù)比較的少,而且我還在官方的模板基礎(chǔ)上注釋掉了幾個(gè)參數(shù)。

3.為每個(gè)實(shí)力單獨(dú)創(chuàng)建目錄

點(diǎn)擊(此處)折疊或打開(kāi)

  1. [root@wbg mysql]# mkdir /mydata

  2. [root@wbg mysql]# cd /mydata

  3. [root@wbg mydata]# mkdir 3306

  4. [root@wbg mydata]# mkdir 3308

  5. [root@wbg mydata]# chown -R mysql:mysql /mydata/

4.初始化實(shí)例(2個(gè)都要做,這里只貼一個(gè)了)(前面2個(gè)是反面教程,最后一個(gè)是對(duì)的)

點(diǎn)擊(此處)折疊或打開(kāi)

  1. [root@wbg mysql]# bin/mysqld --initialize --user=mysql defaults-file=/etc/my.cnf

  2. 2017-10-23T09:13:53.872808Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

  3. 2017-10-23T09:13:54.385216Z 0 [Warning] InnoDB: New log files created, LSN=45790

  4. 2017-10-23T09:13:54.547668Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

  5. 2017-10-23T09:13:54.630447Z 0 [ERROR] Too many arguments (first extra is 'defaults-file=/etc/my.cnf').

  6. 2017-10-23T09:13:54.630493Z 0 [ERROR] Aborting

需要添加--explicit_defaults_for_timestamp這個(gè)配置,要不然有警告。

點(diǎn)擊(此處)折疊或打開(kāi)

  1. [root@wbg mysql]# bin/mysqld --initialize --user=mysql --defaults-file=/etc/my.cnf   --datadir=/mydata/3308/ --explicit_defaults_for_timestamp

  2. 2017-10-23T09:45:43.659977Z 0 [Warning] InnoDB: New log files created, LSN=45790

  3. 2017-10-23T09:45:43.806836Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

  4. 2017-10-23T09:45:43.912638Z 0 [ERROR] unknown variable 'defaults-file=/etc/my.cnf'

  5. 2017-10-23T09:45:43.912685Z 0 [ERROR] Aborting

initialize和defaults-file的順序也要注意,我在這里耽誤了很多時(shí)間。

點(diǎn)擊(此處)折疊或打開(kāi)

  1. [root@wbg mysql]# bin/mysqld --defaults-file=/etc/my.cnf  --initialize --user=mysql  --datadir=/mydata/3308/ --explicit_defaults_for_timestamp

  2. 2017-10-23T09:50:48.217054Z 0 [Warning] InnoDB: New log files created, LSN=45790

  3. 2017-10-23T09:50:48.430856Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

  4. 2017-10-23T09:50:48.500114Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: a5c39a70-b7d7-11e7-a63a-080027736559.

  5. 2017-10-23T09:50:48.510651Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

  6. 2017-10-23T09:50:48.513336Z 1 [Note] A temporary password is generated for root@localhost: 6epfT_PyU+EG

最后的這個(gè)是正確的。

5.安裝SSL

點(diǎn)擊(此處)折疊或打開(kāi)

  1. [root@wbg mysql]# bin/mysql_ssl_rsa_setup

  2. Generating a 2048 bit RSA private key

  3. ......................+++

  4. ................................................+++

  5. writing new private key to 'ca-key.pem'

  6. -----

  7. Generating a 2048 bit RSA private key

  8. .......................................................................................+++

  9. ..................................................................................................................+++

  10. writing new private key to 'server-key.pem'

  11. -----

  12. Generating a 2048 bit RSA private key

  13. ..............................+++

  14. ...........+++

  15. writing new private key to 'client-key.pem'

  16. -----

在MySQL 5.7.6以上的版本,需要安裝這個(gè),不然會(huì)有如下的警告

點(diǎn)擊(此處)折疊或打開(kāi)

  1. 2017-10-23T18:15:21.506002Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key

6.在profile中增加一段配置

點(diǎn)擊(此處)折疊或打開(kāi)

  1. PATH=$PATH:/usr/local/mysql/bin

7.設(shè)置每個(gè)實(shí)例的登陸口令(2個(gè)實(shí)例都要做)

設(shè)置密碼,利用默認(rèn)密碼

點(diǎn)擊(此處)折疊或打開(kāi)

  1. [root@wbg ~]# mysql -S /tmp/mysql.sock3308 -p

  2. Enter password:

  3. Welcome to the MySQL monitor. Commands end with ; or \g.

  4. Your MySQL connection id is 12

  5. Server version: 5.7.18

  6. Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

  7. Oracle is a registered trademark of Oracle Corporation and/or its

  8. affiliates. Other names may be trademarks of their respective

  9. owners.

  10. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  11. mysql> alter user user() identified by 'bb';

  12. Query OK, 0 rows affected (0.00 sec)


8.測(cè)試一下

點(diǎn)擊(此處)折疊或打開(kāi)

  1. [root@wbg ~]# mysqld_multi report

  2. Reporting MySQL servers

  3. MySQL server from group: mysqld3306 is not running

  4. MySQL server from group: mysqld3308 is not running

  5. [root@wbg ~]# mysqld_multi start

  6. [root@wbg ~]# mysqld_multi report

  7. Reporting MySQL servers

  8. MySQL server from group: mysqld3306 is running

  9. MySQL server from group: mysqld3308 is running


到這里多實(shí)例就配置完成了。

額外說(shuō)明:

1.這種配置最后只有一個(gè)實(shí)例可以用tcp/ip。在my.cnf的[client]下,最后只能有一組配置可以生效。所有的實(shí)例都可以用socket去連接。
2.我這里演示的,是用root作為administrative account,而且它們的密碼都是一樣的,如果root的密碼不一樣,官方文檔也有解決方案。

點(diǎn)擊(此處)折疊或打開(kāi)

  1. Make sure that the MySQL account used for stopping the mysqld servers (with the mysqladmin program) has the same user name and password for each server. Also, make sure that the account has the SHUTDOWN privilege. If the servers that you want to manage have different user names or passwords for the administrative accounts, you might want to create an account on each server that has the same user name and password. For example, you might set up a common multi_admin account by executing the following commands for each server:

點(diǎn)擊(此處)折疊或打開(kāi)

  1. shell> mysql -u root -S /tmp/mysql.sock -p

  2. Enter password:

  3. mysql> CREATE USER 'multi_admin'@'localhost' IDENTIFIED BY 'multipass';

  4. mysql> GRANT SHUTDOWN ON *.* TO 'multi_admin'@'localhost';

3.在編輯my.cnf的時(shí)候,要注意[mysqld_multi]下的user是mysqld_multi的administrative account,這是mysql的用戶。
[mysqldN]下的user是OS的用戶。這些通過(guò)官方文檔的模板可以很快的看出來(lái)。

以上是“Mysql多實(shí)例如何安裝配置”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

標(biāo)題名稱:Mysql多實(shí)例如何安裝配置
網(wǎng)頁(yè)地址:http://jinyejixie.com/article22/pppijc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、網(wǎng)站策劃網(wǎng)站改版、電子商務(wù)、全網(wǎng)營(yíng)銷推廣網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(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)

網(wǎng)站托管運(yùn)營(yíng)
当雄县| 丹凤县| 沾益县| 铜山县| 德江县| 施秉县| 瓮安县| 木兰县| 汽车| 三门县| 吉木乃县| 原平市| 麻栗坡县| 桓台县| 专栏| 焦作市| 丘北县| 海城市| 从化市| 志丹县| 文安县| 景德镇市| 西昌市| 隆尧县| 台州市| 招远市| 淮阳县| 汝州市| 从江县| 盐源县| 安顺市| 武穴市| 广汉市| 双流县| 寻乌县| 金山区| 微博| 张家界市| 都江堰市| 东安县| 龙泉市|