1 yum install mariadb-server
2 mkdir /mysqldb/{3306,3307,3308}/{etc,socket,pid,log,data} -pv
chown -R mysql.mysql /mysqldb/
3 mysql_install_db --datadir=/mysqldb/3306/data --user=mysql
mysql_install_db --datadir=/mysqldb/3307/data --user=mysql
mysql_install_db --datadir=/mysqldb/3308/data --user=mysql
4
cp /etc/my.cnf /mysqldb/3306/etc/
vim /mysqldb/3306/etc/my.cnf
[mysqld]
port=3306
datadir=/mysqldb/3306/data
socket=/mysqldb/3306/socket/mysql.sock
[mysqld_safe]
log-error=/mysqldb/3306/log/mariadb.log
pid-file=/mysqldb/3306/pid/mariadb.pid
#!includedir /etc/my.cnf.d
cp /mysqldb/3306/etc/my.cnf /mysqldb/3307/etc/my.cnf
cp /mysqldb/3306/etc/my.cnf /mysqldb/3308/etc/my.cnf
vim /mysqldb/3308/etc/my.cnf
vim /mysqldb/3307/etc/my.cnf
5
cp mysqld /mysqldb/3306/
cp mysqld /mysqldb/3307/
cp mysqld /mysqldb/3308/
chmod 700 /mysqldb/3308/mysqld
chmod 700 /mysqldb/3307/mysqld
chmod 700 /mysqldb/3306/mysqld
vim /mysqldb/3306/mysqld
vim /mysqldb/3307/mysqld
vim /mysqldb/3308/mysqld
6 /mysqldb/3308/mysqld start
/mysqldb/3307/mysqld start
/mysqldb/3306/mysqld start
7
mysql -S /mysqldb/3308/socket/mysql.sock
mysql -S /mysqldb/3307/socket/mysql.sock
mysql -S /mysqldb/3306/socket/mysql.sock
emp
1 a
2 b
3 c
title
1 ceo
2 cto
select
union
select
select st.name,sc.score from students as st inner join scores as sc on st.stuid=sc.stuid and score >( select avg(score) from scores);
select * from (select s.stuid,s.name as studentname,t.tid,t.name as teachername from students as s left outer join teachers as t on s.teacherid=t.tid union select s.stuid,s.name,t.tid,t.name from students as s right outer join teachers as t on s.teacherid=t.tid ) as a where a.stuid is null or a.tid is null;