mysql_install_db出错,Unable to lock /usr/local/mysql/var/ibdata1, error: 11

今天,在一台旧机器上编译一个新的Mysql,install时出了错:
复制代码
/usr/local/mysql_5615/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql_5615/ --datadir=/mnt/disk1/mysql_5615/ 

Installing MySQL system tables...2014-01-20 16:59:22 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-01-20 16:59:22 7fb9ca4d06f0 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2014-01-20 16:59:22 7fb9ca4d06f0 InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!
2014-01-20 16:59:22 30853 [Note] InnoDB: The InnoDB memory heap is disabled
2014-01-20 16:59:22 30853 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-01-20 16:59:22 30853 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-01-20 16:59:22 30853 [Note] InnoDB: Using CPU crc32 instructions
2014-01-20 16:59:22 30853 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2014-01-20 16:59:22 30853 [Note] InnoDB: Completed initialization of buffer pool
2014-01-20 16:59:22 30853 [ERROR] InnoDB: Unable to lock /usr/local/mysql/var/ibdata1, error: 11
2014-01-20 16:59:22 30853 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2014-01-20 16:59:22 30853 [Note] InnoDB: Retrying to lock the first data file
2014-01-20 16:59:23 30853 [ERROR] InnoDB: Unable to lock /usr/local/mysql/var/ibdata1, error: 11
2014-01-20 16:59:23 30853 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.

循环打印此错N次……

2014-01-20 17:01:00 30853 [ERROR] InnoDB: Unable to lock /usr/local/mysql/var/ibdata1, error: 11
2014-01-20 17:01:00 30853 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2014-01-20 17:01:01 30853 [ERROR] InnoDB: Unable to lock /usr/local/mysql/var/ibdata1, error: 11
2014-01-20 17:01:01 30853 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2014-01-20 17:01:02 30853 [ERROR] InnoDB: Unable to lock /usr/local/mysql/var/ibdata1, error: 11
2014-01-20 17:01:02 30853 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2014-01-20 17:01:02 30853 [Note] InnoDB: Unable to open the first data file
2014-01-20 17:01:02 7fb9ca4d06f0  InnoDB: Operating system error number 11 in a file operation.
InnoDB: Error number 11 means 'Resource temporarily unavailable'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
2014-01-20 17:01:02 30853 [ERROR] InnoDB: Can't open '/usr/local/mysql/var/ibdata1'
2014-01-20 17:01:02 30853 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2014-01-20 17:01:02 30853 [ERROR] Plugin 'InnoDB' init function returned error.
2014-01-20 17:01:02 30853 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2014-01-20 17:01:02 30853 [ERROR] Unknown/unsupported storage engine: InnoDB
2014-01-20 17:01:02 30853 [ERROR] Aborting
复制代码

 

它试图去lock /usr/local/mysql/var/ibdata1,这并不是我想要的行为。我指定的basedir=/usr/local/mysql_5615,datadir=/mnt/disk1/mysql_5615,想来想去也不明白。可是怎么找到/usr/local/mysql/var/ibdata1来的呢?我查了查,服务器上的确有一个mysqld已经在跑了,而且用的就是这个数据文件。我的正确解决办法总不能是把人家的干掉啊。读了读mysql_install_db脚本,有些难懂,一下子也理解不出它为什么指定了这个目录。后来想到它应该是找到了某些我不想要的my.cnf文件。

 

于是查查:
复制代码
/usr/local/mysql_5615/bin/mysqld --verbose --help | grep -A 1 'Default options'
2014-01-20 17:18:49 560 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /mnt/disk1/mysql_5615/my.cnf ~/.my.cnf 
2014-01-20 17:18:49 560 [ERROR] Aborting

2014-01-20 17:18:49 560 [Note] Binlog end
复制代码

 

再ls一下这四个my.cnf,果然发现/etc/my.cnf是存在的。看看内容,正是正在运行的那个mysqld用的。把它暂时改名,再来mysql_install_db ,成功了。
 
回头要细读一下mysql_install_db 脚本了。

另:我还是喜欢什么东西都清清楚楚的。my.cnf还是喜欢放在自己的默认位置,这种用系统默认目录的,总是不喜欢。不过服务器也不是我的,不理了……


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值