搞了一天,记录一下,防止以后全部忘光。
-------------------------------------------------------------------------------------------------------------------------------
事件:服务器B运用环境的MySQL出现重大问题,需要重新对比开发环境A的MySQL,同时需要在开发环境中进行测试。
过程:需要将B的数据全部迁移到A服务器。
环境:GNU/Linux,A--MySQL(5.1-enterprise),B(5.5-enterprise)
由于服务A原先已经有MySQL,所以就需要涉及到如何在同一个环境中安装多个MySQL实例的问题(此过程略去)。
----
20131011数据迁移,从MySQL server B(5.5)迁到 A(5.1)。
----
由于版本不同,配置文件的不同。以下是迁移步骤及遇到的问题。
1. 更改my.cnf配置文件。可参考已经配置好的多个实例的my.cnf。-------该配置可参考如何安装多个MySQL instance的方法。
如果配置中对[mysqld1]中出现对不同engine的设置,要将后面的相关对应参数屏蔽。
特别注意两个参数:
innodb_data_home_dir 修改数据目录,最重要。
innodb_log_group_home_dir 可改可不改。
2. 注意engine类型。show engines;show table status\G;
对比两种环境的表类型,假设如果show engines没有innodb,可迁移过来的表数据engine是innodb,
那么show table status\G; 会出现全部null,且无法查询表的情况。
----
遇到问题:
InnoDB: Unable to lock ./ibdata1, error: 37
解决办法:
InnoDB: Unable to lock ./ibdata1, error: 37
I recently faced the “error InnoDB: Unable to lock ./ibdata1, error: 37 “ while moving my data directory to NFS from local
disk , when I restarted the mysql , the restart failed and I got the error in the error log , all permissions were set properly so
I was not sure whats going wrong , I was sure that there is some problem with the OS not able to lock the file and it was related to NFS so I
1) /etc/init.d/portmap restart
2) /etc/init.d/nfslock restart
需要Ops(root)协助重启nfslock(实际上只重启这个就可以了)。
[mysql@A datadir]$ mysqld_multi report
Reporting MySQL servers
MySQL server from group: mysqld1 is running
MySQL server from group: mysqld2 is running
一切正常。