安装多个mysql实例(debian版本)

我的博客已迁移到xdoujiang.com请去那边和我交流

前言:领导要求在1台DELL R710上安装多个mysql实例

一、安装第1个实例

1、当前系统

cat /etc/debian_version

6.0.10

2、查看安装包

apt-cache search mysql-server|grep "mysql-server"

mysql-server-5.1 - MySQL database server binaries and system database setup

mysql-server-core-5.1 - MySQL database server binaries

mysql-server - MySQL database server (metapackage depending on the latest version)

3、安装mysql(会安装mysql相关的一系列的包)

apt-get -y install mysql-server --force-yes

二、安装第二个实例

1、创建目录(我这边将第二个实例安装在/opt下)

cd /opt/

mkdir mysql3307

2、复制mysql表和配置文件

cd /var/lib/mysql/

cp -a mysql /opt/mysql3307/

cp /etc/mysql/my.cnf /opt/mysql3307/

3、修改配置(一般就是改下port和sock和pid和datadir路径)

port            = 3307

socket          = /var/run/mysqld/mysqld3307.sock

pid-file        = /var/run/mysqld/mysqld3307.pid

datadir         = /opt/mysql3307

4、给mysql权限

chown -R mysql.root /opt/mysql3307/

5、启mysql(这里使用mysql用户启)

修改/etc/passed文件

mysql:x:102:104:MySQL Server,,,:/var/lib/mysql:/bin/bash

su - mysql

/usr/sbin/mysqld --defaults-file=/opt/mysql3307/my.cnf --basedir=/usr --datadir=/opt/mysql3307/ --user=mysql --pid-file=/var/run/mysqld/mysqld3307.pid --skip-external-locking --port=3307 --socket=/var/run/mysqld/mysqld3307.sock &

[1] 2484

150505  9:30:06 [Note] Plugin 'FEDERATED' is disabled.

150505  9:30:07  InnoDB: Initializing buffer pool, size = 8.0M

150505  9:30:07  InnoDB: Completed initialization of buffer pool

InnoDB: The first specified data file ./ibdata1 did not exist:

InnoDB: a new database to be created!

150505  9:30:07  InnoDB: Setting file ./ibdata1 size to 10 MB

InnoDB: Database physically writes the file full: wait...

150505  9:30:07  InnoDB: Log file ./ib_logfile0 did not exist: new to be created

InnoDB: Setting log file ./ib_logfile0 size to 5 MB

InnoDB: Database physically writes the file full: wait...

150505  9:30:07  InnoDB: Log file ./ib_logfile1 did not exist: new to be created

InnoDB: Setting log file ./ib_logfile1 size to 5 MB

InnoDB: Database physically writes the file full: wait...

InnoDB: Doublewrite buffer not found: creating new

InnoDB: Doublewrite buffer created

InnoDB: Creating foreign key constraint system tables

InnoDB: Foreign key constraint system tables created

150505  9:30:07  InnoDB: Started; log sequence number 0 0

150505  9:30:07 [Note] Event Scheduler: Loaded 0 events

150505  9:30:07 [Note] /usr/sbin/mysqld: ready for connections.

Version: '5.1.73-1'  socket: '/var/run/mysqld/mysqld3307.sock'  port: 3307  (Debian)

6、最后查看2个mysql实例是否正常运行着

ps aux|grep mysql

root      2152  0.0  0.0   3956   616 ?        S    08:53   0:00 /bin/sh /usr/bin/mysqld_safe

mysql     2276  0.0  3.6 182456 37560 ?        Sl   08:53   0:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306

root      2277  0.0  0.0   5348   688 ?        S    08:53   0:00 logger -t mysqld -p daemon.error

mysql     2480  0.0  0.1  36884  1232 pts/0    S    09:29   0:00 su - mysql

mysql     2481  0.0  0.1  19220  1976 pts/0    S    09:29   0:00 -su

mysql     2484  5.5  3.6 174064 37004 pts/0    Sl   09:30   0:00 /usr/sbin/mysqld --defaults-file=/opt/mysql3307/my.cnf --basedir=/usr --datadir=/opt/mysql3307/ --user=mysql --pid-file=/var/run/mysqld/mysqld3307.pid --skip-external-locking --port=3307 --socket=/var/run/mysqld/mysqld3307.sock

mysql     2495  0.0  0.1  16340  1136 pts/0    R+   09:30   0:00 ps aux

mysql     2496  0.0  0.0   7548   820 pts/0    S+   09:30   0:00 grep mysql

7、登陆2个mysql实例看下

mysql -uroot -predhat -S /var/run/mysqld/mysqld.sock

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 54

Server version: 5.1.73-1 (Debian)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

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

mysql> quit

Bye

mysql -uroot -predhat -S /var/run/mysqld/mysqld3307.sock

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.1.73-1 (Debian)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

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

mysql> quit

Bye

mysql@10:~$

三、引擎

当前版本引擎

mysql -uroot -predhat -S /var/run/mysqld/mysqld.sock -e "show engines;"

+------------+---------+----------------------------------------------------------------+--------------+------+------------+

| Engine     | Support | Comment                                                        | Transactions | XA   | Savepoints |

+------------+---------+----------------------------------------------------------------+--------------+------+------------+

| InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |

| MRG_MYISAM | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |

| BLACKHOLE  | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |

| CSV        | YES     | CSV storage engine                                             | NO           | NO   | NO         |

| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |

| FEDERATED  | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |

| ARCHIVE    | YES     | Archive storage engine                                         | NO           | NO   | NO         |

| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance         | NO           | NO   | NO         |

+------------+---------+----------------------------------------------------------------+--------------+------+------------+

配置修改默认引擎为innodb

是在[mysqld]这个里面

default_table_type = innodb

5.5的话默认引擎直接是innodb了 不需要修改

©著作权归作者所有:来自51CTO博客作者xdoujiang的原创作品,如需转载,请注明出处,否则将追究法律责任

debian安装什么mysql_安装多个mysql实例(debian版本)相关推荐

  1. 宝塔mysql5.6安装不了_宝塔面板Mysql 5.6版本无法正常启动的解决方法

    数据库出问题,网站就很尴尬了,前段时间就遇到了两个数据库上的问题,来看一下 朋友找我的时候说的是 Mysql 启动不了,看他发的截图是宝塔面板,就要来了面板信息去看了一下 第一个问题 第一个问题是 p ...

  2. 阿里云 mysql升级_如何升级阿里云MySQL实例的版本?

    从MySQL 5.5升级至MySQL 5.6 RDS控制台提供了MySQL 5.5到MySQL 5.6一键升级的功能,详细步骤请参见升级数据库版本. •从MySQL 5.6高可用版升级至MySQL 5 ...

  3. wordpress支持MySQL5.5_CentOS 5.5安装Nginx、PHP(FastCGI)、MySQL --搭建LNMP环境安装Wordpress...

    一.总体介绍 系统环境  CentOS release 5.5 (Final)   ,kernel  2.6.18-194.el5 安装 Nginx . PHP(FastCGI)   . MySQL  ...

  4. 如何实现一台机器上运行多个MySQL实例?

    在一台机器上一个MySQL服务器运行多个MySQL实例有什么好处?这里我先入为主给大家介绍这样做至少存在两个好处(看完这篇文章后理解会更透彻): (1)减轻服务器链接负担 (2)为不同的用户提供不同的 ...

  5. powerdns mysql_安装PowerDNS(使用MySQL后端)和Poweradmin在Debian Lenny

    安装PowerDNS(带MySQL后端)和Poweradmin在Debian Lenny上 本文介绍如何在Debian Lenny系统上安装PowerDNS名称服务器(使用MySQL后端)和Power ...

  6. pdns backend mysql_安装PowerDNS(与MySQL后端)和Poweradmin在Debian蚀刻

    安装PowerDNS(带MySQL后端)和Poweradmin在Debian Etch上 版本1.0 作者:Falko Timme 本文介绍如何在Debian Etch系统上安装PowerDNS名称服 ...

  7. tengine php mysql_安装Tengine php mysql

    安装Tengine php mysql 系统环境: [root@web02 soft]# lsb_release -a LSB Version: :core-4.0-amd64:core-4.0-ia ...

  8. apache 编译安装php mysql_编译安装APACHE+PHP+MYSQL

    adminjun qq:279872 网络技术研究会群:8070045 中国linux公社论坛群:4478487 其实这是我用RouterOS和redhat linux进行pppoe服务器的配置及在r ...

  9. 二进制编译安装mysql_数据库(MySQL)二进制安装+编译安装 + MariaDB编译安装

    配置文件: my.cnf [mysql] :只用于mysql这个客户端 [mysqld] [client]:共享与所有客户端,如mysqldump等 MySQL二进制包安装:(在 mysql/下有个 ...

最新文章

  1. java字节流6_JavaIO流之字节流
  2. windows通过脚本批量设置环境变量(env、path)实战:java环境、scala环境、maven环境、gradle环境、nodejs、git等
  3. RCP:解决Navigator快捷键不生效的问题
  4. 说说对npm的开发模式和生产模式的理解
  5. 设计模式のObserver Pattern(观察者模式)----行为模式
  6. maven中jar下载失败
  7. 01-申明变量及变量命名
  8. Redis 5.0 正式版发布了,19 个新特性
  9. 用了自定义Banner后,SpringBoot瞬间变的高大上了...
  10. 志高空调,到了最危险的时候!
  11. 如何维护应用程序状态
  12. Volume Manager for mac 详细教程
  13. socket通信需要网线连接吗_socket方式实现网络通信
  14. Microsoft 补丁下载
  15. 详解麦肯锡方法:结构化分析问题的技术
  16. 52类110个主流的Java框架
  17. Vue--基础模板语法以及计算属性
  18. CF1076C Meme Problem(韦达定理)
  19. 全网最细MySQL数据库下载及安装教程
  20. 桑基图(Echarts)——自定义风格

热门文章

  1. 《Python游戏趣味编程》第12章 坚持一百秒
  2. IntelliJ IDEA、Kotlin 背后公司 JetBrains 在俄罗斯停服
  3. 满满的一整篇,全是 JVM 核心知识点!
  4. 巨杉数据库完成数亿元D轮融资,引领金融级分布式数据库发展
  5. 收好这份来自大厂技术大咖的“远程办公指南”
  6. 战疫,微软资深高管的十余年远程办公管理经验
  7. 详解淘宝直播背后的技术!
  8. 微信成最频繁网络诈骗犯罪工具;库克再谈乔布斯;PyCharm 2019.2.5 发布| 极客头条...
  9. 致初级开发的一封信:坚持写代码!
  10. 如何巧用区块链密码学避免数据“裸奔”?