参考:http://blog.chinaunix.net/u/29134/showart_485759.html
可以说本文关键就是他
mysql max 版本下载.
或者你这 心情好 编译边
参考 : ./configure --prefix=/home/lky/tools/mysql2 --with-plugins=heap,innobase,myisam,ndbcluster,
federated,blackhole --enable-assembler --enable-static
然后 在 my.cnf 的
[mysqld]
federated #加入
mysql 参考:http://blog.chinaunix.net/u3/90603/showart_1925406.html
mysql> show engines;
+------------+----------+----------------------------------------------------------------+--------------+-----+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+----------+----------------------------------------------------------------+--------------+-----+------------+
| ndbcluster | DISABLED | Clustered, fault-tolerant, memory-based tables | YES | NO | NO |
| FEDERATED | YES | Federated MySQL storage engine | YES | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
+------------+----------+----------------------------------------------------------------+--------------+-----+------------+
http://topic.csdn.net/u/20071122/11/016C3D25-82A2-46DC-B8B0-3A22F8573C70.html
测试:
0. mysql_install_db 生成 测试 basedir
1. mysqld_safe 服务器开启
2. mysql 测试
先郁闷句 在max 版本上 没有 mysql_install_db !!,自己想办法把 ,下个其他版本的 给 install database !
[client]
socket=/home/lky/data/d2/mysql.sock
port=3308
[mysqld]
port=3308
datadir=/home/lky/data/d2
socket=/home/lky/data/d2/mysql.sock
user=lky
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
#old_passwords=123
[mysqld_safe]
log-error=/home/lky/data/d2/mysqld.log
pid-file=/home/lky/data/d2/mysqld.pid
命令
启动 服务1 # 注意 my.cnf 的端口 和
datadir
cd /usr/local/mysql-max-5.1.5-alpha-linux-i686-glibc23
update user set host="%" where user='root' ;
./bin/mysqld_safe --defaults-file=/home/lky/data/d1/my.cnf
启动 服务2 # 注意 my.cnf 的端口 和
datadir
cd /usr/local/mysql-max-5.1.5-alpha-linux-i686-glibc23
./bin/mysqld_safe --defaults-file=/home/lky/data/d2/my.cnf
运行1
./bin/mysql --defaults-file=/home/lky/data/d1/my.cnf
>create table t_tableC (id int not null auto_increment primary key, c_str char(20) not null)
>insert into t_tableC values(1,'cc');
运行2
./bin/mysql --defaults-file=/home/lky/data/d2/my.cnf
>create table t_tableC (id int not null auto_increment primary key, c_str char(20) not null)
engine federated
connection = 'mysql://lky@127.0.0.1:3307/test/t_tableC';
> select * from t_tableC ;
+----+-------+
| id | c_str |
+----+-------+
| 1 | cc |
+----+-------+
最让我喜欢的一个特性:
在 d2 上 (运行2)上本地的 表 可以和 federated 进行 表连
mysql> select * from t2 ;
+------+------+
| id | vn |
+------+------+
| 1 | cc |
+------+------+
1 row in set (0.29 sec)
mysql> show create table t2 ;
+-------+----------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+----------------------------------------------------------------------------------------------------------------------+
| t2 | CREATE TABLE `t2` (
`id` int(11) default NULL,
`vn` char(10) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-------+----------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> select * from t_tableC c,t2 t where c.id=c.id ;
+----+--------+------+------+
| id | c_str | id | vn |
+----+--------+------+------+
| 1 | cc | 1 | cc |
| 2 | ccttcc | 1 | cc |
+----+--------+------+------+
2 rows in set (0.00 sec)