1.CentOS5.8 x86_64位 采用最小化安装,系统经过了基本优化篇
2.nginx版本:nginx-1.4.7
3.源码包存放位置:/home/oldboy/tools
4.源码包编译安装位置:/application/
5.已经安装了单实例的mysql,路径在/usr/local/mysql
一.mysql多实例启动设置
1.新建目录:
[root@ser200 ~]# mkdir /data/{3306,3307}/data -p
[root@ser200 ~]# tree /data
/data
|-- 3306
| `-- data
|-- 3307
| `-- data
2.关闭单实例的mysql自动启
[root@ser200 3307]# chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@ser200 3307]# chkconfig mysqld off ;
[root@ser200 3307]# chkconfig --list mysqld
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
3.上传启动和配置文件my.cnf,mysql启动脚本到对应的目录下面
[root@ser200 data]# cd 3306
[root@ser200 3306]# ls
data
[root@ser200 3306]# rz
rz waiting to receive.
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring my.cnf...
100% 1 KB 1 KB/sec 00:00:01 0 Errors
Transferring mysql...
100% 1 KB 1 KB/sec 00:00:01 0 Errors
4.修改/data目录的属主
[root@ser200 bin]# chown mysql:mysql /data
5.增加mysql启动脚本的执行权限
[root@ser200 bin]# chmod 700 /data/3306/mysql
[root@ser200 bin]# ll /data/3306/mysql
-rwx------ 1 mysql mysql 1053 Apr 12 2012 /data/3306/mysql
[root@ser200 bin]# chmod 700 /data/3307/mysql
6.安装数据库
[root@ser200 bin]# mysql_install_db --datadir=/data/3307/data --user=mysql
[root@ser200 bin]# mysql_install_db --datadir=/data/3306/data --user=mysql
7.设置mysql数据库的登陆密码
[root@ser200 3306]# mysqladmin -uroot password ‘mybaby3307‘ -S /data/3307/mysql.sock
[root@ser200 3306]# mysql -uroot -p -S /data/3307/mysql.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73-log Source distributio
8.安装过程报错处理方法:
A.错误1
InnoDB: Error: auto-extending data file ./ibdata1 is of a different size #原因,ibdata1和配置文件的大小不对应
InnoDB: 1024 pages (rounded down to MB) than specified in the .cnf file:
InnoDB: initial 1088 pages, max 0 (relevant if non-zero) pages!
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
B.错误2
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100
InnoDB: Error: all log files must be created at the same time.
InnoDB: All log files must be created also in database creation. #目录下的LOG文件时间ibdata1创建时间不一致
InnoDB: If you want bigger or smaller log files, shut down the
InnoDB: database and make sure there were no errors in shutdown.
InnoDB: Then delete the existing log files. Edit the .cnf file
InnoDB: and start the database again.
141027 10:42:26 [ERROR] Plugin ‘InnoDB‘ init function returned error.
141027 10:42:26 [ERROR] Plugin ‘InnoDB‘ registration as a STORAGE ENGINE failed.
141027 10:42:26 [ERROR] Unknown/unsupported table type: InnoDB
141027 10:42:26 [ERROR] Aborting
处理方法:
删除ibdata1,ip_*的log,启动mysql正常
[root@ser200 data]# rm ibdata1
rm: remove regular file `ibdata1‘?
[root@ser200 data]# rm ib*
rm: remove regular file `ibdata1‘?
[root@ser200 data]# rm ib* -f
[root@ser200 data]# ll
total 8
drwx------ 2 mysql root 4096 Oct 27 08:44 mysql
drwx------ 2 mysql root 4096 Oct 27 08:44 test
原文地址:http://txidc.blog.51cto.com/9138217/1568390