mysql多版本例項安裝
mysql多例項在一臺資源足夠的情況下管理多個資料庫,其中包括安裝一個資料庫軟體初使化多個資料目錄,埠不一樣就可以。還可安裝不同資料庫版本來統一管理,各例項資料不共享。
1.安裝mysql5.6資料庫
[root@test01 ~]# yum -y install autoconf libaio* --mysql5.6依賴autoconf包,mysql5.7依賴libaio包。
[root@test01 ~]# ll
total 2310240
-rw-------. 1 root root 1421 Aug 5 2019 anaconda-ks.cfg
-rw-r--r--. 1 root root 328563044 May 23 12:17 mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz
-rw-r--r--. 1 root root 661718255 May 21 17:54 mysql-5.7.33-linux-glibc2.12-x86_64.tar.gz
-rw-r--r--. 1 root root 1375394901 May 7 00:31 Percona-Server-8.0.23-14-Linux.x86_64.glibc2.17.tar.gz
[root@test01 ~]# tar xvf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@test01 ~]# tar xvf mysql-5.7.33-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@test01 ~]# tar xvf Percona-Server-8.0.23-14-Linux.x86_64.glibc2.17.tar.gz -C /usr/local/
[root@test01 ~]# cd /usr/local/
[root@test01 local]# mv mysql-5.6.40-linux-glibc2.12-x86_64/ mysql-5.6.40
[root@test01 local]# mv mysql-5.7.33-linux-glibc2.12-x86_64/ mysql-5.7.33
[root@test01 local]# mv Percona-Server-8.0.23-14-Linux.x86_64.glibc2.17/ Percona-Server-8.0.23
[root@test01 local]# cd mysql-5.6.40/
[root@test01 mysql-5.6.40]# ./scripts/mysql_install_db --user=mysql --group=mysql --basedir=/usr/local/mysql-5.6.40/ --datadir=/usr/local/mysql-5.6.40/data
[root@test01 mysql-5.6.40]# cp -a support-files/mysql.server /etc/init.d/mysql5.6
[root@test01 mysql-5.6.40]# chkconfig --add mysql5.6
[root@test01 mysql-5.6.40]# chkconfig mysql5.6 on
[root@test01 mysql-5.6.40]# vim /usr/local/mysql-5.6.40/my.cnf
[mysqld]
basedir = /usr/local/mysql-5.6.40
datadir = /usr/local/mysql-5.6.40/data
port = 3306
server_id = 10
[root@test01 mysql-5.6.40]# vim /etc/init.d/mysql5.6
basedir=/usr/local/mysql-5.6.40
datadir=/usr/local/mysql-5.6.40/data
conf=/usr/local/mysql-5.6.40/my.cnf
[root@test01 mysql-5.6.40]# /etc/init.d/mysql5.6 start
Starting MySQL.Logging to '/usr/local/mysql-5.6.40/data/test01.err'.
. SUCCESS!
[root@test01 mysql-5.6.40]#
2.安裝mysql5.7資料庫(安裝方法與mysql5.6不一樣)
[root@test01 mysql-5.7.33]# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql-5.7.33/ --datadir=/usr/local/mysql-5.7.33/data
2021-05-23T06:35:35.375853Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see document
ation for more details).2021-05-23T06:36:20.825902Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-05-23T06:36:22.319561Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-05-23T06:36:22.637220Z 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: 30af30d2-bb91-11eb-a024-00505693d5b3.2021-05-23T06:36:22.675831Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-05-23T06:36:24.471795Z 0 [Warning] CA certificate ca.pem is self signed.
2021-05-23T06:36:24.862429Z 1 [Note] A temporary password is generated for root@localhost:
m5/Gw+pRl#Lr --預設初使密碼
[root@test01 mysql-5.7.33]# cp -a support-files/mysql.server /etc/init.d/mysql5.7
[root@test01 mysql-5.7.33]# chkconfig --add mysql5.7
[root@test01 mysql-5.7.33]# chkconfig mysql5.7 on
[root@test01 mysql-5.7.33]# vim my.cnf
[mysqld]
basedir = /usr/local/mysql-5.7.33
datadir = /usr/local/mysql-5.7.33/data
port = 3307
server_id = 20
[root@test01 mysql-5.7.33]# vim /etc/init.d/mysql5.7
basedir=/usr/local/mysql-5.7.33
datadir=/usr/local/mysql-5.7.33/data
conf=/usr/local/mysql-5.7.33/my.cnf
[root@test01 mysql-5.7.33]# /etc/init.d/mysql5.7 start
Starting MySQL.Logging to '/usr/local/mysql-5.7.33/data/test01.err'.
SUCCESS!
[root@test01 mysql-5.7.33]#
3.安裝Percona-Server8.0資料庫
[root@test01 local]# cd Percona-Server-8.0.23/
[root@test01 Percona-Server-8.0.23]# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/Percona-Server-8.0.23/ --datadir=/usr/local/Percona-Server-8.0.23/da
ta2021-05-23T06:51:18.058721Z 0 [System] [MY-013169] [Server] /usr/local/Percona-Server-8.0.23/bin/mysqld (mysqld 8.0.23-14) initializing of server in progress as proc
ess 163582021-05-23T06:51:18.201151Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-05-23T06:51:32.631345Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-05-23T06:51:48.164084Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost:
P-Vkfhobh3>k --預設初使密碼
[root@test01 Percona-Server-8.0.23]# chkconfig --add Percona8.0
[root@test01 Percona-Server-8.0.23]# chkconfig Percona8.0 on
[root@test01 Percona-Server-8.0.23]# vim my.cnf
[mysqld]
basedir = /usr/local/Percona-Server-8.0.23
datadir = /usr/local/Percona-Server-8.0.23/data
port = 3308
server_id = 30
[root@test01 Percona-Server-8.0.23]# /etc/init.d/Percona8.0 start
Starting MySQL (Percona Server)... SUCCESS!
[root@test01 Percona-Server-8.0.23]#
[root@test01 ~]# cp -a /usr/local/Percona-Server-8.0.23/support-files/mysqld_multi.server /etc/init.d/mysqld_multi
[root@test01 ~]# vim /etc/my.cnf
[mysqld_multi] --公共配置
user=root
pass=123456 --這裡的密碼配置是pass不是password。
mysqld=/usr/local/Percona-Server-8.0.23/bin/mysqld_safe --如果是多個版本資料庫,以下兩行可不寫。如果是一個資料庫不同資料檔案這兩行要寫。
mysqladmin=/usr/local/Percona-Server-8.0.23/bin/mysqladmin
log=/var/log/mysql.log --多例項啟動和停止日誌檔案
[mysqld56] --名稱必須是mysqld開頭,56之間不能有點或橫線。
basedir = /usr/local/mysql-5.6.40
datadir = /usr/local/mysql-5.6.40/data
port = 3306
server_id = 10
socket = /usr/local/mysql-5.6.40/mysql.sock
mysqld=/usr/local/mysql-5.6.40/bin/mysqld_safe --啟動資料庫命令
mysqladmin=/usr/local/mysql-5.6.40/bin/mysqladmin --關閉資料庫命令
[mysqld57]
basedir = /usr/local/mysql-5.7.33
datadir = /usr/local/mysql-5.7.33/data
port = 3307
server_id = 20
socket=/usr/local/mysql-5.7.33/mysql.sock
mysqld=/usr/local/mysql-5.7.33/bin/mysqld_safe
mysqladmin=/usr/local/mysql-5.7.33/bin/mysqladmin
[mysqld80]
basedir = /usr/local/Percona-Server-8.0.23
datadir = /usr/local/Percona-Server-8.0.23/data
port = 3308
server_id = 30
socket=/usr/local/Percona-Server-8.0.23/mysql.sock
mysqld=/usr/local/Percona-Server-8.0.23/bin/mysqld_safe
mysqladmin=/usr/local/Percona-Server-8.0.23/bin/mysqladmin
[root@test01 ~]# /etc/init.d/mysqld_multi report
Reporting MySQL (Percona Server) servers
MySQL (Percona Server) from group: mysqld56 is running
MySQL (Percona Server) from group: mysqld57 is running
MySQL (Percona Server) from group: mysqld80 is running
[root@test01 ~]# /etc/init.d/mysqld_multi stop 56,57 --關閉56,57例項
[root@test01 ~]# /etc/init.d/mysqld_multi report
Reporting MySQL (Percona Server) servers
MySQL (Percona Server) from group: mysqld56 is not running
MySQL (Percona Server) from group: mysqld57 is not running
MySQL (Percona Server) from group: mysqld80 is running
[root@test01 ~]# /etc/init.d/mysqld_multi start 56
[root@test01 ~]# /etc/init.d/mysqld_multi report
Reporting MySQL (Percona Server) servers
MySQL (Percona Server) from group: mysqld56 is running
MySQL (Percona Server) from group: mysqld57 is not running
MySQL (Percona Server) from group: mysqld80 is running
[root@test01 ~]#
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25854343/viewspace-2773545/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Swoole 基本例項建立
- mysql 5.7.14 免安裝版注意事項(精)MySql
- mysql多例項安裝MySql
- 解壓縮版mysql安裝及注意事項MySql
- MySQL:mysql5.7解壓版安裝與解除安裝MySql
- mysql安裝教程-windows版MySqlWindows
- mysql 綠色版 安裝MySql
- MySQL安裝之二_安裝配置泥潭版MySql
- Laradock php mysql 安裝多版本PHPMySql
- Mysql 5.7 免安裝版windows安裝完整教程MySqlWindows
- MySQL安裝之一_安裝配置順利版MySql
- MySQL介紹及安裝與多例項MySql
- mysql在linux上cmake安裝方法(自己安裝版)MySqlLinux
- Mac安裝壓縮版MySQL ServerMacMySqlServer
- MySQL5.7綠色版安裝MySql
- mysql5.7.22解壓版安裝教程MySql
- MySQL5.7.21免安裝版如何配置MySql
- 教程:MySQL 8安裝與配置及注意事項MySql
- 批處理安裝綠色版MySQL 5.7.24MySql
- Ubuntu18.10安裝MySQL(最簡單版)UbuntuMySql
- mysql-8.4.0解壓版安裝記錄MySql
- mysql免安裝版的實際配置方法MySql
- mysql 安裝MySql
- 安裝mysqlMySql
- MySQL安裝MySql
- Linux安裝解除安裝MySQLLinuxMySql
- MySQL在Windows和Linux平臺上多版本多例項安裝配置方法(5.5、5.6、5.7、8.0)MySqlWindowsLinux
- Windows作業系統安裝MySQL解壓版Windows作業系統MySql
- MySQL5.7.21解壓版安裝詳細教程MySql
- MySql 5.7.14 解壓版安裝步驟詳解MySql
- 安裝MySQL後,需要調整的10個效能配置項MySql
- 連網安裝mysql與原始碼安裝mysqlMySql原始碼
- 【MySQL安裝】Linux下安裝MySQL(預編譯)MySqlLinux編譯
- win10安裝版怎麼安裝_安裝版win10安裝教程Win10
- 【推薦 - glibc安裝】MySQL - 安裝MySql
- MySQL 8.0.21下載安裝教程及Navicat for MySQL安裝MySql
- 安裝mysql和mysql workbenchMySql
- 高版本mysql8.0解壓版安裝步驟MySql