今天,在一台旧机器上编译一个新的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...-- ::  [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
-- :: 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.
-- :: 7fb9ca4d06f0 InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!
-- :: [Note] InnoDB: The InnoDB memory heap is disabled
-- :: [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
-- :: [Note] InnoDB: Compressed tables use zlib 1.2.
-- :: [Note] InnoDB: Using CPU crc32 instructions
-- :: [Note] InnoDB: Initializing buffer pool, size = 16.0M
-- :: [Note] InnoDB: Completed initialization of buffer pool
-- :: [ERROR] InnoDB: Unable to lock /usr/local/mysql/var/ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [Note] InnoDB: Retrying to lock the first data file
-- :: [ERROR] InnoDB: Unable to lock /usr/local/mysql/var/ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 循环打印此错N次…… -- :: [ERROR] InnoDB: Unable to lock /usr/local/mysql/var/ibdata1, error:
-- :: [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
-- :: [ERROR] InnoDB: Unable to lock /usr/local/mysql/var/ibdata1, error:
-- :: [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.
-- :: [Note] InnoDB: Unable to open the first data file
-- :: 7fb9ca4d06f0 InnoDB: Operating system error number in a file operation.
InnoDB: Error number 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
-- :: [ERROR] InnoDB: Can't open '/usr/local/mysql/var/ibdata1'
-- :: [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!
-- :: [ERROR] Plugin 'InnoDB' init function returned error.
-- :: [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
-- :: [ERROR] Unknown/unsupported storage engine: InnoDB
-- :: [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  'Default options'
-- :: [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
-- :: [ERROR] Aborting -- :: [Note] Binlog end
再ls一下这四个my.cnf,果然发现/etc/my.cnf是存在的。看看内容,正是正在运行的那个mysqld用的。把它暂时改名,再来mysql_install_db ,成功了。
 
回头要细读一下mysql_install_db 脚本了。

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

mysql_install_db出错,Unable to lock /usr/local/mysql/var/ibdata1, error: 11的更多相关文章

  1. Starting MySQL.. ERROR! The server quit without updating PID file (/usr/local/mysql/var/AYXXXXXXXXXXX.pid). 错误解决方法

    /etc/init.d/mysql start无法启动MySQL错误信息如下: ERROR! MySQL server PID file could not be found! Starting My ...

  2. mysql 初始化报错 /usr/local/mysql/bin/mysqld:error while loading shared libraries :libaio.so.1

    安装mysql在初始化的时候,出现/usr/local/mysql/bin/mysqld:error while loading shared libraries:libaio.so.1 :canno ...

  3. mysql初始化/usr/local/mysql/bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory

    [root@test153 ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql - ...

  4. mysql常见错误/usr/local/mysql/bin/mysqld: [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

    出现这种情况多数是找不到data目录,还有就是对data目录没有写入权限.

  5. -bash: /usr/local/mysql/scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory

    安装 MySQL 初始化时,报错如下: [root@hcdb1 ~]# /usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/m ...

  6. mysql之 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11

    问题描述:启动MySQL后,出现连接不上,报 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11[root@mysql01 ~]# service ...

  7. Starting MySQL.. ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).

      [root@localhost ~]# cd /usr/local/mysql   [root@localhost mysql]# chown -R mysql.mysql . [root@loc ...

  8. [mysqldumpslow 报错] Died at /usr/local/mysql/bin/mysqldumpslow line 161, <> chunk 236.

    mysqldumpslow报错:Died at /usr/local/mysql/bin/mysqldumpslow line 161, <> chunk 236. 总结:是由于top数目 ...

  9. linux mysql -- ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid)

    转载 http://blog.csdn.net/caiyaodeng/article/details/45937183 linux 链接mysql 报错 ERROR! The server quit ...

随机推荐

  1. Oracle练习

    --声明一个变量,并给它赋值 declare  v_bonus number(8); begin select id*6 into v_bonus from A where Id=5; DBMS_OU ...

  2. 3 分钟的高速体验 Apache Spark SQL

    "War of the Hadoop SQL engines. And the winner is -?" 这是一个非常好的问题.只要.无论答案是什么.我们都值花一点时间找出 Sp ...

  3. windows phone (19) 深入了解TextBlock

    原文:windows phone (19) 深入了解TextBlock TextBlock 一般用于显示文本的元素,我们最为经常用到的是该类的Text属性,其实显示文本有两种呈现方式,一个是设置内部文 ...

  4. jquery实现仿select列表的即时搜索及拼音搜索

    这里提到select,其实不是select,而是用<li><input>标签去仿造一个select,以实现对已有“option”的快速检索功能. 以<input>标 ...

  5. C陷阱与缺陷之语法陷阱

    2.1理解函数声明 不论什么C变量的声明都由两部分组成:类型以及一组类似表达式的声明符号.比如 float f; 这个声明的含义是:当对其求值时,表达式f和g的类型为浮点数类.由于声 明符与表达式的相 ...

  6. 和学生探讨吉林大学python问题

    学生们真的很强大,我知道玩微信,nodejs.... 我们去学校了解.当时互联网开始64K....

  7. 使用Socket沟通

    当两台电脑TCP/IP协议进行通讯.平时Socket对象来表示该通信接口的两端,并通过Socket生产I/O流进行网络通信. 其中ServerSocket对象可以接收从连接的其他通信实体的请求.这个目 ...

  8. linux free

    在Linux下查看内存我们一般用command free [root@nonamelinux ~]# free total           used           free        s ...

  9. 很久没来这里,今天的评测java怪东西,左右Date类和时间戳转换

    在发展过程中,经常会遇到利用上课时间.说话的Date类就不得不提时间戳,左右fr=aladdin" target="_blank">的定义大家能够看看网上对时间戳的 ...

  10. 基于 Android 的 3D 视频示例代码

    笔者:Mark Liu 下载样本代码 简单介绍 在Android 中,创建一个可以播放视频剪辑的应用很easy:创建一个採用 3D 图形平面的游戏应用也很easy.可是,创建一个可以在 3D 图形对象 ...