mysql5 6版本多配置檔案安裝例項

2021-12-30 10:37:04 字數 4386 閱讀 8266

mysql5.6版本多配置檔案安裝例項

為新例項建立資料目錄並賦權

#建立兩個目錄分別作為兩個例項的資料目錄

mkdir -p /data/application/mysql-multi-instance/

#為兩個例項的資料目錄賦權,避免在初始化資料庫時出錯

chown mysql:mysql -r /data/application/mysql-multi-instance/使用mysql的mysql_install_db例項化資料庫

./mysql_install_db --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3307 --user=mysql

./mysql_install_db --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3308 --user=mysql編輯兩個例項的配置檔案

#這是3307例項的配置檔案

[client]

port = 3307

socket = /tmp/mysql3307.sock

[mysql]

no-auto-rehash

[mysqld]

user = mysql

port = 3307

socket = /tmp/mysql3307.sock

basedir = /data/application/mysql

datadir = /data/application/mysql-multi-instance/mysql3307

[mysqldump]

quick

max_allowed_packet = 2m

[mysqld_safe]

log-error=/data/application/mysql-multi-instance/mysql3307/mysql_3307.err

pid-file=/data/application/mysql-multi-instance/mysql3307/mysqld.pid#這是3308例項的配置檔案

[client]

port = 3308

socket = /tmp/mysql3308.sock

[mysql]

no-auto-rehash

[mysqld]

user = mysql

port = 3308

socket = /tmp/mysql3308.sock

basedir = /data/application/mysql

datadir = /data/application/mysql-multi-instance/mysql3308

[mysqldump]

quick

max_allowed_packet = 2m

[mysqld_safe]

log-error=/data/application/mysql-multi-instance/mysql3308/mysql_3308.err

pid-file=/data/application/mysql-multi-instance/mysql3308/mysqld.pid啟動例項

mysqld_safe --defaults-file=/data/application/etc/mysql3307.cnf --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3307 --user=mysql &

mysqld_safe --defaults-file=/data/application/etc/mysql3308.cnf --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3308 --user=mysql &檢視啟動結果

#這裡開啟了預設的3306例項,所以有三個例項

root 6794 1 0 oct26 ? 00:00:00 /bin/sh /data/application/mysql/bin/mysqld_safe --defaults-file=/data/application/mysql/my.cnf --basedir=/data/application/mysql --datadir=/data/application/mysqldata --user=mysql

mysql 6902 6794 0 oct26 ? 00:00:37 /data/application/mysql/bin/mysqld --defaults-file=/data/application/mysql/my.cnf --basedir=/data/application/mysql --datadir=/data/application/mysqldata --plugin-dir=/data/application/mysql/lib/plugin --user=mysql --log-error=/data/application/mysqldata/izuf60tfg75y5orqql6pluz.err --pid-file=/data/application/mysqldata/izuf60tfg75y5orqql6pluz.pid

root 16375 11905 0 19:31 pts/3 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/data/application/etc/mysql3307.cnf --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3307 --user=mysql

mysql 16560 16375 0 19:31 pts/3 00:00:00 /data/application/mysql/bin/mysqld --defaults-file=/data/application/etc/mysql3307.cnf --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3307 --plugin-dir=/data/application/mysql/lib/plugin --user=mysql --log-error=/data/application/mysql-multi-instance/mysql3307/mysql_3307.err --pid-file=/data/application/mysql-multi-instance/mysql3307/mysqld.pid --socket=/tmp/mysql3307.sock --port=3307

root 16605 11905 0 19:50 pts/3 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/data/application/etc/mysql3308.cnf --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3308 --user=mysql

mysql 16789 16605 0 19:50 pts/3 00:00:00 /data/application/mysql/bin/mysqld --defaults-file=/data/application/etc/mysql3308.cnf --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3308 --plugin-dir=/data/application/mysql/lib/plugin --user=mysql --log-error=/data/application/mysql-multi-instance/mysql3308/mysql_3308.err --pid-file=/data/application/mysql-multi-instance/mysql3308/mysqld.pid --socket=/tmp/mysql3308.sock --port=3308修改密碼

mysqladmin -u root password -s /tmp/mysql3307.sock

mysqladmin -u root password -s /tmp/mysql3308.sock至此記錄完畢

MySQL5 6版本的安裝與配置

一.個人認為,mysql後面的版本真的太難用了,還是5.6左右的幾個版本比較好用,所以推薦。三.配置。1.配置系統環境變數 配置環境變數很簡單 我的電腦 屬性 高階 環境變數,選擇path,在其後面新增 你的mysql bin資料夾的路徑 雙擊此處 2.配置my.ini檔案 my default.i...

Linux yum安裝 MySQL5 6 版本

1.檢查linux系統有沒有自帶安裝mysql yum list installed grep mysql1 1.如果發現則刪除系統自帶的mysql yum y remove mysqlwget3.將rmp檔案加入yum當中去 4.檢視yum中是否存在mysql安裝檔案 yum repolist a...

安裝配置綠色版MySQL5 6

1.複製解壓後根目錄下的my default.ini,重新命名為my.ini儲存到相同路徑下 2.修改my.ini mysqld 設定mysql的安裝目錄,如果目錄中帶空格則必須加引號 basedir c program files x86 mysql 5.6.13 win32 設定mysql資料庫...