一看必会系列:mariadb 单一版本多实例 安装配置 — CCIE那点事

一看必会系列:mariadb 单一版本多实例 安装配置

来源:本站原创 mysql_mariadb 超过74 views围观 0条评论

 

进入官网源配置工具选择指定的源 5.5

https://downloads.mariadb.org/mariadb/repositories/#mirror=shanghai-university&distro=CentOS&distro_release=centos7-amd64–centos7&version=5.5

———配置源
vim /etc/yum.repos.d/mariadb5.5.repo
Here is your custom MariaDB YUM repository entry for CentOS. Copy and paste it into a file under /etc/yum.repos.d/ (we suggest naming the file MariaDB.repo or something similar).

# MariaDB 5.5 CentOS repository list – created 2018-06-12 01:26 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
After the file is in place, install MariaDB with:

yum makecache

———–yum指定安装
yum list |grep mariadb

mariadb.x86_64                           1:5.5.56-2.el7                base       
mariadb-server.x86_64                    1:5.5.56-2.el7                base    

yum install -y mariadb*

[root@ansible03 ~]# rpm -qa |grep maria
mariadb-libs-5.5.56-2.el7.x86_64
mariadb-embedded-5.5.56-2.el7.x86_64
mariadb-bench-5.5.56-2.el7.x86_64
mariadb-5.5.56-2.el7.x86_64
mariadb-devel-5.5.56-2.el7.x86_64
mariadb-embedded-devel-5.5.56-2.el7.x86_64
mariadb-server-5.5.56-2.el7.x86_64
mariadb-test-5.5.56-2.el7.x86_64

systemctl enable mariadb
systemctl restart mariadb

 
———–多实例配置开始——————–

添加MySQL用户
groupadd mysql
useradd -g mysql -s /sbin/nologin mysql

建例mysqldata目录
mkdir -p /Data/mysqldata/33{07,08,09,10}
chown -R mysql:mysql /usr/mysqldata*
mkdir -p /var/log/mysql

另一种方式
mkdir -p /Data/mysqldata/
cd  /Data/mysqldata/
[root@shtsmysql02 mysqldata]# mkdir -p 33{12..24}
[root@shtsmysql02 mysqldata]# ll
total 8
drwxr-xr-x 5 mysql mysql  254 Oct 25 13:51 3307
drwxr-xr-x 5 mysql mysql  278 Jul  3 15:58 3312
drwxr-xr-x 5 mysql mysql 4096 Jul  5 14:24 3312
drwxr-xr-x 6 mysql mysql 4096 Jul  5 13:57 3310
drwxr-xr-x 2 root  root     6 Oct 25 14:00 3321
drwxr-xr-x 2 root  root     6 Oct 25 14:01 3322
drwxr-xr-x 2 root  root     6 Oct 25 14:01 3323
drwxr-xr-x 2 root  root     6 Oct 25 14:00 3324

初始化数据文件
mysql_install_db –datadir=/Data/mysqldata/3312/ –user=mysql
chown -R mysql:mysql /Data/mysqldata/*
如有报错不掉他

ll /Data/mysqldata/3312/

[root@mysql01 mysql]# ll /Data/mysqldata/3312
total 29788
-rw-rw—-. 1 mysql mysql    16384 Jun 29 11:15 aria_log.00000001
-rw-rw—-. 1 mysql mysql       52 Jun 29 11:15 aria_log_control
-rw-rw—-. 1 mysql mysql 18874368 Jun 29 11:17 ibdata1
-rw-rw—-. 1 mysql mysql  5242880 Jun 29 11:17 ib_logfile0
-rw-rw—-. 1 mysql mysql  5242880 Jun 29 11:17 ib_logfile1
drwx——. 2 mysql mysql     4096 Jun 29 11:15 mysql
-rw-rw—-. 1 mysql mysql    30797 Jun 29 11:15 mysql-bin.000001
-rw-rw—-. 1 mysql mysql  1069459 Jun 29 11:15 mysql-bin.000002
-rw-rw—-. 1 mysql mysql      467 Jun 29 11:24 mysql-bin.000003
-rw-rw—-. 1 mysql mysql       57 Jun 29 11:17 mysql-bin.index
drwx——. 2 mysql mysql     4096 Jun 29 11:15 performance_schema
drwx——. 2 mysql mysql        6 Jun 29 11:15 test
[root@mysql01 mysql]#

修改配置文件开始多实例—这一步一定要
vim /etc/my.cnf

#添加引导模块
[mysqld_multi]
mysqld     = /usr/bin/mysqld_safe
#指定程序目录启动文件(mysqld_safe安全模式的启动方式)
mysqladmin = /usr/bin/mysqladmin
#指定管理程序所在的目录
user       = mysql
password   = mysql
#指定是那一个用户(必须是系统是存在的用户)

新建配置文件

mkdir /etc/mysql
chown -R mysql:mysql /etc/mysql

[root@mysql01 mysql]# ll
total 12
-rw-r–r–. 1 mysql mysql 654 Jun 27 17:01 cfg_1.cnf
-rw-r–r–. 1 mysql mysql 654 Jun 27 17:00 mysql3312.cnf
-rw-r–r–. 1 root  root  654 Jun 29 11:17 cfg_3.cnf
[root@mysql01 mysql]# pwd
/etc/mysql

vim替换命令
:%s/3312/3310

vim /etc/mysql/mysql3312.cnf

配置与原配置相似
[mysqld3312]
port=3312
#占用的端口(每一个实例一个端口)
socket=/tmp/mysql3312.sock
##指定套接字文件所在的目录
pid-file=/tmp/mysql3312.pid
##指定锁文件所在位置
#max_allowed_packet=1M
#net_buffer_length=2k
##包消息缓冲区初始化为net_buffer_length字节,但需要时可以增长到max_allowed_packet字节
#table_open_cache=4
##所有线程打开的表的个数
#sort_buffer_size=64k
##排序buffer大小;线程级别
#thread_stack=128k
##每个线程的堆栈大小
#basedir=/usr/local/mysql
##源文件所在的目录
datadir=/Data/mysqldata/3312
##数据实例目录
server-id=1
##指定为主服务器

—————-推荐启停方式————————————–
以服务的方式启动、停止,需修改配置文件
/usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/mysql3312.cnf –log=/var/log/mysql_3312.log start

启动后进行授权
mysql -S /tmp/mysql3312.sock  本地登陆
grant shutdown on *.* to  mysql@localhost identified by ‘mysql’;
flush privileges;

停止命令
/usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/mysql3312.cnf –log=/var/log/mysql_3312.log stop

————-多实例配置完成———————–

[root@ansible03 mysql]# !net
netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 0.0.0.0:3312            0.0.0.0:*               LISTEN      14804/mysqld       
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1875/sshd          
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2042/master        
tcp6       0      0 :::22                   :::*                    LISTEN      1875/sshd          
tcp6       0      0 ::1:25

##############以下为加分内容#############################

——————用以上命令出现无法停机故障 查看日志发现权限不够
[root@shjhmysql02 ~]# tail -f /var/log/mysql_3312.log
Stopping MySQL servers

/usr/bin/mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘mysql’@’localhost’ (using password: YES)’
mysqld_multi log file version 2.16; run: Sat Sep 23 14:26:04 2017

Stopping MySQL servers

/usr/bin/mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘mysql’@’localhost’ (using password: YES)’

解决方案:
增加mysql权限
mysql -S /tmp/mysql3312.sock  本地登陆
grant shutdown on *.* to  mysql@localhost identified by ‘mysql’;
flush privileges;

验证:
mysqld_multi log file version 2.16; run: Sat Sep 23 14:26:38 2017

Stopping MySQL servers

/usr/bin/mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘mysql’@’localhost’ (using password: YES)’
mysqld_multi log file version 2.16; run: Sat Sep 23 14:28:44 2017

Stopping MySQL servers   —停止正常

 

—————服务形式启动———————————–
完整文件
vim /etc/systemd/system/mysqld@.service

[Unit]
Description=MySQL Multi Server for instance %i
After=syslog.target
After=network.target

[Service]
User=mysql
Group=mysql
Type=forking
#ExecStart=/usr/bin/mysqld_multi –defaults-file=/etc/mysql/cfg_%i.cnf –log=/var/log/mysql_multi.log start %i
#ExecStop=/usr/bin/mysqld_multi –log=/var/log/mysql_multi.log stop %i
ExecStart=/usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/cfg_%i.cnf –log=/var/log/mysql_multi.log start
ExecStop=/usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/cfg_%i.cnf –log=/var/log/mysql_multi.log stop
Restart=always
RestartSec=5
PrivateTmp=true

[Install]
WantedBy=multi-user.target

 

启动测试
systemctl start mysqld@2.service
Warning: mysqld@2.service changed on disk. Run ‘systemctl daemon-reload’ to reload units

需先运行 systemctl daemon-reload

netstat -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State     
tcp        0      0 0.0.0.0:3307            0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:3312            0.0.0.0:*               LISTEN   —已启动 
tcp        0      0 0.0.0.0:3312            0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN    
tcp6       0      0 :::80                   :::*                    LISTEN    
tcp6       0      0 :::22

状态
[root@mysql01 mysql]# systemctl status mysqld@2.service
● mysqld@2.service – MySQL Multi Server for instance 2
   Loaded: loaded (/etc/systemd/system/mysqld@.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2017-06-29 17:43:35 CST; 29s ago
  Process: 87923 ExecStop=/usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/cfg_%i.cnf –log=/var/log/mysql_multi.log stop (code=exited, status=0/SUCCESS)
  Process: 87936 ExecStart=/usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/cfg_%i.cnf –log=/var/log/mysql_multi.log start (code=exited, status=0/SUCCESS)
Main PID: 87942 (mysqld_safe)
   CGroup: /system.slice/system-mysqld.slice/mysqld@2.service
           ├─87942 /bin/sh /usr/bin/mysqld_safe –port=3312 –socket=/tmp/mysql3312.sock –pid-file=/tmp/mysql3312.pid –datadir=/usr/mys…
           └─88218 /usr/libexec/mysqld –basedir=/usr –datadir=/Data/mysqldata3312 –plugin-dir=/usr/lib64/mysql/plugin –server-id=1 –…

Jun 29 17:43:35 mysql01 systemd[1]: Starting MySQL Multi Server for instance 2…
Jun 29 17:43:35 mysql01 systemd[1]: Started MySQL Multi Server for instance 2.

停机测试

[root@mysql01 mysql]# systemctl stop mysqld@2.service
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State     
tcp        0      0 0.0.0.0:3307            0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:3312            0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN    
tcp6       0      0 :::80                   :::*                    LISTEN    
tcp6       0      0 :::22                   :::*                    LISTEN    
[root@mysql01 mysql]# systemctl status mysqld@2.service
● mysqld@2.service – MySQL Multi Server for instance 2
   Loaded: loaded (/etc/systemd/system/mysqld@.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

Jun 29 17:42:43 mysql01 systemd[1]: Starting MySQL Multi Server for instance 2…
Jun 29 17:42:43 mysql01 systemd[1]: Started MySQL Multi Server for instance 2.
Jun 29 17:42:48 mysql01 systemd[1]: mysqld@2.service holdoff time over, scheduling restart.
Jun 29 17:42:48 mysql01 systemd[1]: Starting MySQL Multi Server for instance 2…
Jun 29 17:42:49 mysql01 systemd[1]: Started MySQL Multi Server for instance 2.
Jun 29 17:43:34 mysql01 systemd[1]: Stopping MySQL Multi Server for instance 2…
Jun 29 17:43:35 mysql01 systemd[1]: Starting MySQL Multi Server for instance 2…
Jun 29 17:43:35 mysql01 systemd[1]: Started MySQL Multi Server for instance 2.
Jun 29 17:45:30 mysql01 systemd[1]: Stopping MySQL Multi Server for instance 2…
Jun 29 17:45:31 mysql01 systemd[1]: Stopped MySQL Multi Server for instance 2.
[root@mysql01 mysql]#

 

—————以下启停方式不推荐—————————
mysql -uroot -p -S  /tmp/mysql3312.sock
停止一个实例
mysqld_multi –defaults-extra-file=/etc/mysql/cfg_3.cnf stop
正常来说你是停不掉的,因为权限不对。
这样做的目地只有一个,是允许那一个用户关闭此实例,如果不是此用户对此实例关闭,那么此实例会自动重启,
也就是说无法正常关闭(当此实例工作过程中意外中断也会自动重启的)
grant shutdown on *.* to  root@localhost identified by ‘#$h342jh’;
flush privileges;

如何本地管理
mysql -S /tmp/mysql3312.sock

——————————————————————————
上面的方式能启能停但无法管理,且不生成 mysql.socket 和mysql.pid,
从最后的结果来看应该也是mysql这个帐户的权限问题修正后即可。
加入权限后已可管理。
[root@mysql01 mysql]# mysql -S /tmp/mysql3310.sock
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.52-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]>

—————管理实例—————–
mysql -S /tmp/mysql3310.sock

上面的方式能启能停但无法管理

[root@mysql01 mysql]# mysql -S /tmp/mysql3310.sock
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql3310.sock’ (2)
[root@mysql01 mysql]#

——————-有时会碰到无法管理——————-
[root@shtsmysql01 ~]# mysql -S /tmp/mysql3307.sock
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
[root@shtsmysql01 ~]#
提示ROOT无权限

所成mysql 提示密码不对
[root@shtsmysql01 ~]# mysql -umysql -p -S /tmp/mysql3307.sock
Enter password:
ERROR 1045 (28000): Access denied for user ‘mysql’@’localhost’ (using password: YES)
[root@shtsmysql01 ~]#

原因是
[mysqld3307]
datadir=/Data/mysqldata3307   —-少了一这条,不配置默认会使用原mysql配置
修改后解决

当然出现这个问题
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.

解决方法和上面也是一样的

 

————–新问题 配置完成后无法启动—————-
[root@shtsmysql01 3322]# /usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/cfg3321.cnf –log=/var/log/mysql_3321.log start
[root@shtsmysql01 3322]#
netstat -ntlp   ——-无进程
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      982/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2846/sendmail: acce
tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN      1136/zabbix_agentd 
tcp6       0      0 :::22                   :::*                    LISTEN      982/sshd           
tcp6       0      0 :::10050                :::*                    LISTEN      1136/zabbix_agentd 
[root@shtsmysql01 3322]#

日志报错
171025 19:06:27 mysqld_safe Logging to ‘/var/log/mysql.log’.
171025 19:06:27 mysqld_safe Starting mysqld daemon with databases from /Data/mysqldata3321
171025 19:06:30 mysqld_safe mysqld from pid file /tmp/mysql3321.pid ended

—————又有新问题 能启动不能停服务—————-
[root@shtsmysql01 mysql]# /usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/my07.cnf  stop
[root@shtsmysql01 mysql]#
[root@shtsmysql01 mysql]#
[root@shtsmysql01 mysql]# !net
netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 127.0.0.1:199           0.0.0.0:*               LISTEN      983/snmpd          
tcp        0      0 0.0.0.0:3307            0.0.0.0:*               LISTEN      11852/mysqld       
tcp        0      0 0.0.0.0:3312            0.0.0.0:*               LISTEN      12344/mysqld       
tcp        0      0 0.0.0.0:3312            0.0.0.0:*               LISTEN      12814/mysqld       

解决方法,开启日志大法
[root@shtsmysql01 mysql]# /usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/my07.cnf  –log=/var/log/mysql_multi.log stop
查看相应日志
[root@shtsmysql01 ~]# tail -f /var/log/mysql_multi.log
mysqld_multi log file version 2.16; run: Mon Jul  3 15:26:15 2017

Stopping MySQL servers

/usr/bin/mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘mysql’@’localhost’ (using password: YES)’

原因是mysql 没有停止权限。

————————给启停服务帐号授权————————
mysql -S /tmp/mysql3312.sock

use mysql;
grant shutdown on *.* to mysql@’localhost’ identified by ‘mysql’;
flush privileges;

MariaDB [mysql]> use mysql;
Database changed
MariaDB [mysql]> grant shutdown on *.* to mysql@’localhost’ identified by ‘mysql’;
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]>

现在有管理权限可以启停

验证  停止3307服务
[root@shtsmysql01 mysql]# /usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/my07.cnf  –log=/var/log/mysql_multi.log stop
netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name           
tcp        0      0 0.0.0.0:3312            0.0.0.0:*               LISTEN      12344/mysqld       
tcp        0      0 0.0.0.0:3312            0.0.0.0:*               LISTEN      12814/mysqld       
tcp        0      0 0.0.0.0:3310            0.0.0.0:*               LISTEN      13285/mysqld       

[root@shtsmysql01 ~]# tail -5 /var/log/mysql_multi.log
error: ‘Access denied for user ‘mysql’@’localhost’ (using password: YES)’
mysqld_multi log file version 2.16; run: Mon Jul  3 15:45:32 2017

Stopping MySQL servers  —–停止信息

[root@shtsmysql01 ~]#

———————多实例配置完成———————–
配置两台Mysql主主同步 参考上面。

———————以下为不可管理的故障说明———————-

[root@mysql01 mysql]# ps aux |grep 3310
mysql     93783  0.0  0.1 113256  1584 ?        S    18:06   0:00 /bin/sh /usr/bin/mysqld_safe –port=3310 –socket=/tmp/mysql3310.sock –pid-file=/tmp/mysql3310.pid –datadir=/Data/mysqldata3310 –server-id=1
mysql     94059  0.0  8.3 771324 83384 ?        Sl   18:06   0:00 /usr/libexec/mysqld –basedir=/usr –datadir=/Data/mysqldata3310 –plugin-dir=/usr/lib64/mysql/plugin –server-id=1 –log-error=/var/log/mariadb/mariadb.log –pid-file=/tmp/mysql3310.pid –socket=/tmp/mysql3310.sock –port=3310
root      94541  0.0  0.0 112648   964 pts/0    R+   18:09   0:00 grep –color=auto 3310

但手动运行却有
[root@mysql01 mysql]# /usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/cfg_4.cnf start
[root@mysql01 mysql]# ll /tmp/
total 12
-rw-rw—-. 1 mysql mysql  6 Jun 27 17:16 mysql3307.pid
srwxrwxrwx. 1 mysql mysql  0 Jun 27 17:16 mysql3307.sock
-rw-rw—-. 1 mysql mysql  6 Jun 29 11:17 mysql3312.pid
srwxrwxrwx. 1 mysql mysql  0 Jun 29 11:17 mysql3312.sock
-rw-rw—-. 1 mysql mysql  6 Jun 29 18:12 mysql3310.pid
srwxrwxrwx. 1 mysql mysql  0 Jun 29 18:12 mysql3310.sock

手动运行却无法停止——最后证明是权限问题
[root@mysql01 mysql]# /usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/cfg_4.cnf stop
[root@mysql01 mysql]# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 0.0.0.0:3307            0.0.0.0:*               LISTEN      14292/mysqld       
tcp        0      0 0.0.0.0:3312            0.0.0.0:*               LISTEN      12001/mysqld       
tcp        0      0 0.0.0.0:3310            0.0.0.0:*               LISTEN      97448/mysqld       
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2209/sshd          
tcp6       0      0 :::80                   :::*                    LISTEN      875/httpd          
tcp6       0      0 :::22                   :::*                    LISTEN      2209/sshd          
[root@mysql01 mysql]#

使用mysqladmin shutdown 可以停止
[root@mysql01 mysql]# mysqladmin shutdown -S /tmp/mysql3310.sock
netstat -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State     
tcp        0      0 0.0.0.0:3307            0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:3312            0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN    
tcp6       0      0 :::80                   :::*                    LISTEN  

 

———————排查过程————————–
查日志,当然要先开启

在配置文件增加配置
log=/var/log/mariadb/mariadb3310.log                                                                                                      
"cfg_4.cnf" 24L, 691C

查看对应日志文件    
170630 11:37:32        1 Connect    mysql@localhost as anonymous on
            1 Connect    Access denied for user ‘mysql’@’localhost’ (using password: YES)

查日志确认是权限问题
MariaDB [mysql]> grant shutdown on *.* to mysql@’localhost’ identified by ‘mysql’;
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

再试一下,看结果搞定
[root@mysql01 mysql]# /usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/cfg_4.cnf stop
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 0.0.0.0:3307            0.0.0.0:*               LISTEN      14292/mysqld       
tcp        0      0 0.0.0.0:3312            0.0.0.0:*               LISTEN      12001/mysqld       
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2209/sshd          
tcp6       0      0 :::80                   :::*                    LISTEN      875/httpd          
tcp6       0      0 :::22                   :::*                    LISTEN      2209/sshd          
[root@mysql01 mysql]#

结总一下命令
开启
/usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/cfg_4.cnf start
停止
/usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/cfg_4.cnf stop
管理
mysql -S /tmp/mysql3310.sock

———-安装完无法启动

Redirecting to /bin/systemctl start  mariadb.service

解决方法

yum install -y mariadb*

—-以上好吧怎么试都没有用,不管怎么指定都是
yum install mariadb-5.5.56-2.el7.x86_64

Dependencies Resolved

===========================================================================================================================
Package                        Arch                   Version                               Repository               Size
===========================================================================================================================
Installing:
MariaDB-client                 x86_64                 10.1.33-1.el7.centos                  mariadb                  39 M
Installing for dependencies:
MariaDB-common                 x86_64                 10.1.33-1.el7.centos                  mariadb                 123 k

Transaction Summary
===========================================================================================================================
Install  1 Package (+1 Dependent package)

Total size: 40 M
Total download size: 39 M
Installed size: 173 M
Is this ok [y/d/N]: n

—————以上问题确认

因为存在两个mariadb的源,最简单的方法直接删除一个,mariadb5.5的配置不需动

文章出自:CCIE那点事 http://www.jdccie.com/ 版权所有。本站文章除注明出处外,皆为作者原创文章,可自由引用,但请注明来源。 禁止全文转载。
本文链接:http://www.jdccie.com/?p=3779转载请注明转自CCIE那点事
如果喜欢:点此订阅本站
  • 相关文章
  • 为您推荐
  • 各种观点

暂时还木有人评论,坐等沙发!
发表评论

快捷键:Ctrl+Enter