centos7 7安裝mysql8多例項3307

2021-10-19 22:25:25 字數 4278 閱讀 6337

檢查系統中是否存在mysql的檔案

find / -name mysql
刪除存在mysql的檔案或資料夾

rm -rf /usr/lib64/mysql/
檢查是否存在mysql的相關依賴

rpm -qa|

grep mysql

解除安裝mysql的依賴

rpm -e mysql-..

...

建立使用者和資料夾

useradd mysql

passwd mysql

su mysql

wget

mkdir /data &&

cd /data

tar -zxvf mysql-8.0.23-el7-x86_64.tar.gz

mv mysql-8.0.23-el7-x86_64 mysql_3306

cp -r mysql_3306 mysql_3307

su root

chown -r mysql:mysql /data/mysql_3306/ /data/mysql_3307/

su mysql

cd /data/mysql_3306

vim my.cnf

[mysqld]

port=3306

basedir=/data/mysql_3306/

datadir=/data/mysql_3306/data/

socket=/data/mysql_3306/mysql.sock

max_connect_errors=10

character-set-server=utf8

default-storage-engine=innodb

user=mysql

slow_query_log=on

slow_query_log_file=/data/mysql_3306/slow-query.log

[client]

port=3306

socket=/data/mysql_3306/mysql.sock

default-character-set=utf8

default_authentication_plugin=mysql_native_password

vim /data/mysql_3306/support-files/mysql.server

basedir=/data/mysql_3306/

datadir=/data/mysql_3306/data/

#set some defaults

mysqld_pid_file_path=/data/mysql_3306/mysqld.pid

iftest -z "$basedir"

then

basedir=/data/mysql_3306/

bindir=/data/mysql_3306/bin

iftest -z "$datadir"

then

datadir=/data/mysql_3306/data

fisbindir=/data/mysql_3306/bin

libexecdir=/data/mysql_3306/bin

#try to find basedir in /etc/my.cnf

conf=/data/mysql_3306/my.cnf

vim /data/mysql_3306/support-files/mysqld_multi.server

basedir=/data/mysql_3306/

bindir=/data/mysql_3306/bin

初始化,記錄密碼

cd /data/mysql_3306

./bin/mysqld --defaults-file=/data/mysql_3306/my.cnf --initialize --console --user=mysql

執行

cd /data/mysql_3306

./bin/mysqld_safe --defaults-file=./my.cnf &

連線mysql

./bin/mysql --socket=./mysql.sock -uroot -p # 輸入初始密碼

修改密碼

alter user root@localhost identified by 「root」;

啟動指令碼

vim mysql_start.sh

./bin/mysqld_safe --defaults-file=./my.cnf &
關閉指令碼

vim mysql_shutdown.sh

./bin/mysqladmin -uroot -p123456 -s /data/mysql_3306/mysql.sock shutdown
#遠端設定

mysql> use mysql;

mysql> update user set host=

'%' where user=

'root'

;mysql> grant all privileges on *.* to 'root'@'%'with grant option;

mysql> flush privileges;

連線

cd /data/mysql_3306

./bin/mysql --socket=./mysql.sock -uroot -p

修改賬戶密碼加密規則並更新使用者密碼

alter user 『root』@』%』 identified by 『password』 password expire never; #修改加密規則

alter user 『root』@』%』 identified with mysql_native_password by 『password』; #更新一下使用者的密碼

重新整理許可權並重置密碼

flush privileges; #重新整理許可權

3307配置

vim /data/mysql_3307/support-files/mysql.server

[mysqld]

port=3307

basedir=/data/mysql_3307/

datadir=/data/mysql_3307/data/

socket=/data/mysql_3307/mysql.sock

max_connect_errors=10

character-set-server=utf8

default-storage-engine=innodb

user=mysql

slow_query_log=on

slow_query_log_file=/data/mysql_3307/slow-query.log

[client]

port=3307

socket=/data/mysql_3307/mysql.sock

default-character-set=utf8

default_authentication_plugin=mysql_native_password

vim /data/mysql_3307/support-files/mysql.server

vim /data/mysql_3307/support-files/mysqld_multi.server

初始化,記錄密碼

./bin/mysqld --defaults-file=/data/mysql_3307/my.cnf --initialize --console --user=mysql
執行

cd /data/mysql_3307

./bin/mysqld_safe --defaults-file=./my.cnf &

Centos7 7安裝docker記錄

如果之前安裝過docker,需要解除安裝 sudo yum remove docker docker client docker client latest docker common docker latest docker latest logrotate docker logrotate do...

centos7 7安裝部署docker

系統版本 centos linux release 7.7.1908 core 核心版本 3.10.0 1062.el7.x86 64 更新yum源和docker源 root k8s docker yum.repos.d rm rf etc yum.repos.d 刪除所有預設的源 root k8s...

Centos7 7之離線安裝kubectl

centos7.7,kubernates 1.13.5.我的centos7.7上已經安裝了kubernates 1.13.5,但是沒有kubectl命令,手動安裝 瀏覽器中訪問得到的最新的穩定版本,但是我們需要的版本是1.13.5,之後將kubectl檔案傳到伺服器上,chmod x kubectl...