# Here follows entries for some specific programs [mysqld_multi] mysqld = /usr/local/mysql/bin/mysqld_safe mysqladmin = /usr/local/mysql/bin/mysqladmin user = root log = /var/log/mysql/mysqld.multi.log #password = #如果你的mysql实例有密码这一项就要启动,并且写上密码,不然管理脚本可以启动,不能停止
[root@e3 mariadb-10.0.15]# cp /usr/local/mysql/support-files/mysqld_multi.server /etc/init.d/mysqld.multi [root@e3 mariadb-10.0.15]# chmod +x /etc/init.d/mysqld.multi修改多实例脚本来同时启动,关闭3个实例[root@e3 mariadb-10.0.15]# vim /etc/init.d/mysqld.multi编辑修改#!/bin/sh # # A simple startup script for mysqld_multi by Tim Smith and Jani Tolonen. # This script assumes that my.cnf file exists either in /etc/my.cnf or # /root/.my.cnf and has groups [mysqld_multi] and [mysqldN]. See the # mysqld_multi documentation for detailed instructions. # # This script can be used as /etc/init.d/mysql.server # # Comments to support chkconfig on RedHat Linux # chkconfig: 2345 64 36 # description: A very fast and reliable SQL database engine. # # Version 1.0 #
if test -x $bindir/mysqld_multi then mysqld_multi="$bindir/mysqld_multi"; else echo "Can"t execute $bindir/mysqld_multi from dir $basedir"; exit; fi
case "$1" in "start" ) "$mysqld_multi" --defaults-extra-file=$conf start $2 ;; "stop" ) "$mysqld_multi" --defaults-extra-file=$conf stop $2 ;; "report" ) "$mysqld_multi" --defaults-extra-file=$conf report $2 ;; "restart" ) "$mysqld_multi" --defaults-extra-file=$conf stop $2 "$mysqld_multi" --defaults-extra-file=$conf start $2 ;; *) echo "Usage: $0 {start|stop|report|restart}" >&2 ;; esac来测试![root@e3 mariadb-10.0.15]# /etc/init.d/mysqld.multi start 1,2,3 [root@e3 mariadb-10.0.15]# netstat -antlp |grep mysqld tcp 0 0 :::3307 :::* LISTEN 20628/mysqld tcp 0 0 :::3308 :::* LISTEN 20630/mysqld tcp 0 0 :::3306 :::* LISTEN 20619/mysqld [root@e3 mariadb-10.0.15]# /etc/init.d/mysqld.multi stop 1,2,3 [root@e3 mariadb-10.0.15]# netstat -antlp |grep mysqld如何连接数据库[root@e3 tmp]# mysql -S /tmp/mysql3307.sock 这样可以连接 Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 2 Server version: 10.0.15-MariaDB Source distribution
Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
Type "help;" or "h" for help. Type "c" to clear the current input statement.
MariaDB [(none)]>
[root@e3 tmp]# mysql -uroot -h127.0.0.1 -P3306 -p 这样也可以连接 Enter password: Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 3 Server version: 10.0.15-MariaDB Source distribution
Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
Type "help;" or "h" for help. Type "c" to clear the current input statement.
MariaDB [(none)]>以此类推。在 CentOS/RHEL/Scientific Linux 6 下安装 LAMP (Apache with MariaDB and PHP) http://www.linuxidc.com/Linux/2013-07/86755.htmMariaDB Proxy读写分离的实现 http://www.linuxidc.com/Linux/2014-05/101306.htmLinux下编译安装配置MariaDB数据库的方法 http://www.linuxidc.com/Linux/2014-11/109049.htmCentOS系统使用yum安装MariaDB数据库 http://www.linuxidc.com/Linux/2014-11/109048.htm安装MariaDB与MySQL并存 http://www.linuxidc.com/Linux/2014-11/109047.htmUbuntu 上如何将 MySQL 5.5 数据库迁移到 MariaDB 10 http://www.linuxidc.com/Linux/2014-11/109471.htm[翻译]Ubuntu 14.04 (Trusty) Server 安装 MariaDB http://www.linuxidc.com/Linux/2014-12/110048htmMariaDB 的详细介绍:请点这里 MariaDB 的下载地址:请点这里本文永久更新链接地址