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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysqld_multi安裝多個mysql例項MySql
- mysql 5.7.14 免安裝版注意事項(精)MySql
- 解壓縮版mysql安裝及注意事項MySql
- mysql多例項安裝MySql
- MySQL在Windows上安裝多個例項的方法MySqlWindows
- mysql 5.7 多例項安裝MySql
- mysql 綠色版 安裝MySql
- mysql安裝教程-windows版MySqlWindows
- MySQL免安裝版配置MySql
- MySQL 免安裝版配置MySql
- MySQL安裝之二_安裝配置泥潭版MySql
- MySQL:mysql5.7解壓版安裝與解除安裝MySql
- mysql 5.7單例項安裝MySql單例
- MySQL安裝之一_安裝配置順利版MySql
- Mysql 5.7 免安裝版windows安裝完整教程MySqlWindows
- mysql 非安裝版的配置MySql
- MySql綠色版安裝配置MySql
- 完全移動版MySQL(MySQL免安裝版的配置)MySql
- MySQL 安裝後的注意事項MySql
- MYSQL 安裝維護注意事項MySql
- oracle 多個例項安裝監聽Oracle
- Laradock php mysql 安裝多版本PHPMySql
- MySQL5.7綠色版安裝MySql
- mysql免安裝版使用方法MySql
- Windows下安裝MySQL解壓版WindowsMySql
- Mac安裝壓縮版MySQL ServerMacMySqlServer
- centos 6.5下i版本例項熱遷移CentOS
- MySQL介紹及安裝與多例項MySql
- 安裝mysql-python注意事項MySqlPython
- mysql在linux上cmake安裝方法(自己安裝版)MySqlLinux
- MySQL的簡單安裝配置(免安裝zip版,版本5.7.21)MySql
- MySQL5.7.21免安裝版如何配置MySql
- MySql 5.6.36 64位綠色版安裝MySql
- mysql免安裝版的實際配置方法MySql
- mysql5.7.22解壓版安裝教程MySql
- 批處理安裝綠色版MySQL 5.7.24MySql
- 免安裝版MySQL的優化與配置MySql優化
- 使用原始碼安裝MYSQL 5.5.9版本原始碼MySql