测试环境基于centos7.2,腾讯云实验室,学习搭建!

https://www.qcloud.com/developer

  多实例mysql,能更加理解mysql安装的基本过程!及简单使用。。。

  mariadb是mysql的衍生版(原作者退出mysql团队,主要是卖给oracle公司!自己想保持开源共享的特性。。。不得不说作者很屌)

Mariadb官方: https://mariadb.com/

00、yum测试

[root@VM_94_232_centos ~]# yum search mariadb
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
=================================== N/S matched: mariadb ====================================
mariadb-bench.x86_64 : MariaDB benchmark scripts and data
mariadb-devel.i686 : Files for development of MariaDB/MySQL applications
mariadb-devel.x86_64 : Files for development of MariaDB/MySQL applications
mariadb-embedded.i686 : MariaDB as an embeddable library
mariadb-embedded.x86_64 : MariaDB as an embeddable library
mariadb-embedded-devel.i686 : Development files for MariaDB as an embeddable library
mariadb-embedded-devel.x86_64 : Development files for MariaDB as an embeddable library
mariadb-libs.x86_64 : The shared libraries required for MariaDB/MySQL clients
mariadb-libs.i686 : The shared libraries required for MariaDB/MySQL clients
mariadb-server.x86_64 : The MariaDB server and related files
mariadb.x86_64 : A community developed branch of MySQL
mariadb-test.x86_64 : The test suite distributed with MariaD
percona-xtrabackup.x86_64 : Online backup for InnoDB/XtraDB in MySQL, Percona Server and  #很出名名的数据库备份,修复的公司,吊炸天

01、安装mysql

yum    install    -y mariadb-server

mkdir /mvpbang/{data3333,data3334}  #创建数据库文件存放位置

02、初始化数据库

mysql_install_db  --datadir=/mvpbang/data33343--user=mysql

mysql_install_db  --datadir=/mvpbang/data3334 --user=mysql

chown -R mysql: /mvpbang/*    #权限设置

Installing MariaDB/MySQL system tables in '/mvpbang/data3334' ...
:: [Note] /usr/libexec/mysqld (mysqld 5.5.-MariaDB) starting as process
...OK
Filling help tables...
:: [Note] /usr/libexec/mysqld (mysqld 5.5.-MariaDB) starting as process
...OK To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands: '/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h VM_94_232_centos password 'new-password'
Alternatively you can run:
'/usr/bin/mysql_secure_installation' #安全设置(删除test库,禁止root远程登录) which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers. See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions. You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mysqld_safe --datadir='/mvpbang/data3334' You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/mysql-test' ; perl mysql-test-run.pl Please report any problems at http://mariadb.org/jira The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Support MariaDB development by buying support/new features from MariaDB
Corporation Ab. You can contact us about this at sales@mariadb.com.
Alternatively consider joining our community based development effort:
http://mariadb.com/kb/en/contributing-to-the-mariadb-project/

03、设置my_multi.cnf

注意:本配置只在乎简单的多实例。对于对引擎等参数的设置,本文该不做介绍

show variables;    #默认参数信息,可根据做对应的调整

[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user = root #只能root管理 [mysqld3333]
socket = /tmp/mysql_3333.sock
port = 3333
pid-file = /mvpbang/data3333/3333.pid
datadir = /mvpbang/data3333
log = /mvpbang/log/mysql3333.log
user = mysql [mysqld3334]
socket = /tmp/mysql_3334.sock
port = 3334
pid-file = /mvpbang/data3333/3334.pid
datadir = /mvpbang/data3334
log = /mvpbang/log/mysql3334.log
user = mysql

04、启动关闭

mysqld_multi   --defaults-extra-file=/etc/my_multi.cnf start | stop 3333,3334    #批量启动关闭
mysqld_multi      --defaults-extra-file=/etc/my_multi.cnf start | stop 3333
mysqld_multi   --defaults-extra-file=/etc/my_multi.cnf start | stop 3334   #单个进行操作

亦可以设置开机启动

vim /etc/rc.d/rc.local

mysqld_multi   --defaults-extra-file=/etc/my_multi.cnf start  3333,3334

05、设置root密码设置密码

设置密码

mysqladmin   -uroot    -S   /tmp/mysql_3333.sock   password 123123;   #sock套接字快速连接
mysqladmin   -uroot   -S   /tmp/mysql_3334.sock    password 123123;

mysql登录

mysql   -uroot   -p      -S /tmp/mysql_3306.sock

06、常见命令参数

mysqld_multi

[root@VM_94_232_centos ~]# mysqld_multi  --help
mysqld_multi version 2.16 by Jani Tolonen Description:
mysqld_multi can be used to start, or stop any number of separate
mysqld processes running in different TCP/IP ports and UNIX sockets. mysqld_multi can read group [mysqld_multi] from my.cnf file. You may
want to put options mysqld=... and mysqladmin=... there. Since
version 2.10 these options can also be given under groups [mysqld#],
which gives more control over different versions.
One can have the
default mysqld and mysqladmin under group [mysqld_multi], but this is
not mandatory. Please note that if mysqld or mysqladmin is missing
from both [mysqld_multi] and [mysqld#], a group that is tried to be
used, mysqld_multi will abort with an error. mysqld_multi will search for groups named [mysqld#] from my.cnf (or
the given --defaults-extra-file=...), where '#' can be any positive
integer starting from . These groups should be the same as the regular
[mysqld] group, but with those port, socket and any other options
that are to be used with each separate mysqld process. The number
in the group name has another function; it can be used for starting,
stopping, or reporting any specific mysqld server.

#使用方法
Usage: mysqld_multi [OPTIONS] {start|stop|report} [GNR,GNR,GNR...] #report 运行状态报告
or mysqld_multi [OPTIONS] {start|stop|report} [GNR-GNR,GNR,GNR-
GNR,...] The GNR means the group number. You can start, stop or report any GNR,
or several of them at the same time. (See --example) The GNRs list can
be comma separated or a dash combined. The latter means that all the
GNRs between GNR1-GNR2 will be affected. Without GNR argument all the
groups found will either be started, stopped, or reported. Note that
syntax for specifying GNRs must appear without spaces. Options: These options must be given before any others:
--no-defaults Do not read any defaults file
--defaults-file=... Read only this configuration file, do not read the #常用语单实例
standard system-wide and user-specific files
--defaults-extra-file=... Read this configuration file in addition to the #多实例配置文件
standard system-wide
and user-specific files
Using: --example Give an example of a config file with extra information.
--help Print this help and exit.
--log=... Log file. Full path to and the name for the log file. NOTE:
If the file exists, everything will be appended.
Using:
--mysqladmin=... mysqladmin binary to be used for a server shutdown.
Since version 2.10 this can be given within groups [mysqld#]
Using:
--mysqld=... mysqld binary to be used. Note that you can give mysqld_safe
to this option also. The options are passed to mysqld. Just
make sure you have mysqld in your PATH or fix mysqld_safe.
Using:
Please note: Since mysqld_multi version 2.3 you can also
give this option inside groups [mysqld#] in ~/.my.cnf,
where '#' stands for an integer (number) of the group in
question. This will be recognised as a special option and
will not be passed to the mysqld. This will allow one to
start different mysqld versions with mysqld_multi.
--no-log Print to stdout instead of the log file. By default the log
file is turned on.
--password=... Password for mysqladmin user.
--silent Disable warnings.
--tcp-ip Connect to the MySQL server(s) via the TCP/IP port instead
of the UNIX socket. This affects stopping and reporting.
If a socket file is missing, the server may still be
running, but can be accessed only via the TCP/IP port.
By default connecting is done via the UNIX socket.
--user=... mysqladmin user. Using: root
--verbose Be more verbose.
--version Print the version number and exit.

mariadb多实例搭建的更多相关文章

  1. centos 6.5 单实例搭建 ELK

    2018-07-02     21:32:33 ELK 单实例搭建 环境搭建 1.1我的系统版本 Distributor ID: CentOS Description:     CentOS rele ...

  2. Windows 实例搭建的 FTP 在外网无法连接和访问

    外网无法连接和访问 Windows 实例搭建的 FTP,这种情况可能是由于以下两种原因导致的: 安全组拦截外网访问 防火墙拦截 FTP 进程 安全组拦截外网访问 这种情况下,可以尝试新建一条入方向的安 ...

  3. 在centos7环境下建立MariaDB多实例

    环境全部基于vmware player 12 os: centos7 mariadb: mariadb-10.1.12-linux-x86_64.tar.gz 主要根据MariaDB给出的帮助文档,以 ...

  4. 负载均衡的mariadb集群搭建

    集群介绍: Galera是一个MySQL(也支持MariaDB,Percona)的同步多主集群软件,目前只支持InnoDB引擎. 主要功能: 同步复制 真正的multi-master,即所有节点可以同 ...

  5. 私有云Mariadb集群搭建

    MariaDB作为Mysql的一个分支,在开源项目中已经广泛使用,例如大热的openstack,所以,为了保证服务的高可用性, 同时提高系统的负载能力,集群部署是必不可少的. MariaDB Gale ...

  6. AWS的EC2实例搭建服务器使用stackoverflow教程

    作为一个技术开发工程师, 一个给力的问题解决方案搜索引擎是十分必要的, stackoverflow作为一个码农必备神器, 存在访问不稳定,有时候打不开的问题,下面介绍如何在亚马逊云服务器上搭建属于自己 ...

  7. MySQL(mariadb)多实例应用与多实例主从复制

    MySQL多实例 mysql多实例,简单理解就是在一台服务器上,mysql服务开启多个不同的端口(如3306.3307,3308),运行多个服务进程.这些 mysql 服务进程通过不同的 socket ...

  8. 二进制mariadb多实例

    实验环境: centos7.6 :IP: 192.168.99.110 1.首先下载二进制的压缩包,解压到一个指定的目录/hx/下 [root@centos7 hx]#tar xf mariadb-1 ...

  9. AWS之EC2实例搭建LAMP服务器

    在 Amazon Linux 2 上安装 LAMP Web 服务器 创建EC2实例,在安全组添加HTTP(80)规则 步骤 1:准备 LAMP 服务器 1.使用putty连接到你的EC2实例上(AMI ...

随机推荐

  1. MVC二级联动使用$.ajax方法获取后端返回的字符串

    在"MVC二级联动使用$.getJSON方法"中使用$.getJSON()获取后端返回的JSon. 本篇使用jQuery的$.ajax()获取后端返回的字符串,实现二级联动.   ...

  2. Blocks与Dispatch Queue的使用

    block是什么block是一个C level的语法以及运行时的一个特性,和标准C中的函数(函数指针)类似.用于回调函数的地方.两个对象间的通讯.实现轻量级的“代理”. blocks和C语言函数指针的 ...

  3. POP按钮动画

    POP按钮动画 效果 源码 https://github.com/YouXianMing/Animations // // ButtonPressViewController.m // Faceboo ...

  4. 乘法器的Verilog HDL实现

    原文链接:http://www.cnblogs.com/shengansong/archive/2011/05/23/2054401.html 1. 串行乘法器  两个N位二进制数x.y的乘积用简单的 ...

  5. centos6.8安装具有ngx_cache_purge模块的nginx1.10.3

    CentOS-6.8 安装 Nginx1.10.3Nginx 环境准备:安装Nginx需要完成以下依赖的安装 1.gcc 安装:yum install gcc-c++ 2.PCRE pcre-deve ...

  6. 使用jQuery动态改变图片显示大小

    当我们要显示后台传过来若干个尺寸不一的图片时,为了保证图片大小的一致性及比例的协调,需要动态改变图片显示尺寸.通过搜索,我们可以从网上找到实现此 功能的jQuery代码如下.这段代码可以使图片的大小保 ...

  7. ajax与java前后台传值及数据表查询解决一个bug的问题

    前台选中某些表,确定提交到后台,偶尔会报500错误,通过排查发现:由于后台代码写的不严谨,导致前台选中的表名如果全不存在的话就会导致后台走异常报500错误,所以决定在前台先对数据进行一次过滤,使至少有 ...

  8. 【Java VisualVM】使用 VisualVM 进行性能分析及调优

    转载:https://blog.csdn.net/lmb55/article/details/79267277 一.概述 开发大型 Java 应用程序的过程中难免遇到内存泄露.性能瓶颈等问题,比如文件 ...

  9. swift语言实现单例模式

    Swift实现单例模式 单例模式在各个语言中都有实现,swift语言推出已经几天了.通过这几天的看文档.特奉上写的Swift的单例实现,供大家学习交流,欢迎指正. ---若转载请注明出处,本人Gith ...

  10. struts2学习笔记(3)---Action中訪问ServletAPI获取真实类型的Servlet元素

    一.源码: struts.xml文件: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE s ...