Bug #68425 Cannot create the database again through mysql_install_db script.
Submitted: 19 Feb 2013 9:23 Modified: 19 Feb 2013 12:13
Reporter: Jigar Dhulla Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S2 (Serious)
Version:5.5.29 OS:Linux (CentOS release 6.3 (Final))
Assigned to: CPU Architecture:Any
Tags: mysql_install_db, mysql.plugin

[19 Feb 2013 9:23] Jigar Dhulla
Description:
Cannot create database manually from the mysql_install_db script.

[root@localhost ~]# /usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var/mysql --user=mysql --skip-grant-tables &
Installing MySQL system tables...
ERROR: 1  Can't create/write to file '/usr/local/local/var/mysql/mysql/db.MYI' (Errcode: 13)
130218 22:15:23 [ERROR] Aborting

130218 22:15:23 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

Installation of system tables failed!  Examine the logs in
/usr/local/mysql/var/mysql for more information.

You can try to start the mysqld daemon with:

    shell> /usr/local/mysql/bin/mysqld --skip-grant &

and use the command line tool /usr/local/mysql/bin/mysql
to connect to the mysql database and look at the grant tables:

    shell> /usr/local/mysql/bin/mysql -u root mysql
    mysql> show tables

Try 'mysqld --help' if you have problems with paths.  Using --log
gives you a log in /usr/local/mysql/var/mysql that may be helpful.

Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS.  Another information source are the
MySQL email archives available at http://lists.mysql.com/.

Please check all of the above before mailing us!  And remember, if
you do mail us, you MUST use the /usr/local/emps/scripts/mysqlbug script!

Here is mysql's error log :

130218 21:09:41 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var/mysql
130218 21:09:42 InnoDB: The InnoDB memory heap is disabled
130218 21:09:42 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130218 21:09:42 InnoDB: Compressed tables use zlib 1.2.3
/usr/local/emps/bin/mysqld: Can't create/write to file '/tmp/ibHBGast' (Errcode: 13)
130218 21:09:42  InnoDB: Error: unable to create temporary file; errno: 13
130218 21:09:42 [ERROR] Plugin 'InnoDB' init function returned error.
130218 21:09:42 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
130218 21:09:42 [ERROR] Unknown/unsupported storage engine: InnoDB
130218 21:09:42 [ERROR] Aborting

130218 21:09:42 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

130218 21:09:42 mysqld_safe mysqld from pid file /usr/local/mysql/var/mysql/mysqld.pid ended

[root@localhost ~]# ls -lha /tmp/
total 12K
drwxrwxrwt   3 root root 4.0K Feb 18 21:06 .
drwx------. 24 root root 4.0K Feb 18 20:29 ..
drwxrwxrwt   2 root root 4.0K Feb 18 20:29 .ICE-unix

I also checked /usr/local/mysql/var/mysql permission is also fine. Owner is mysql like it should be.

How to repeat:
Install MySQL on different path rather than default. Create Database manually from mysql_install_db script.

Suggested fix:
Should be able to create mysql database.
[19 Feb 2013 10:37] MySQL Verification Team
Hello Jigar,

Thank you for the report.
I can not repeat described behavior.

I tried to install in non-default location, and confirmed that system schema created and started mysqld without any issues..
[root@cluster-repo mysql-5_5_29]# scripts/mysql_install_db --basedir=/data/ushastry/server/mysql-5_5_29 --datadir=/tmp/5529 --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/data/ushastry/server/mysql-5_5_29/bin/mysqladmin -u root password 'new-password'
/data/ushastry/server/mysql-5_5_29/bin/mysqladmin -u root -h cluster-repo password 'new-password'

Alternatively you can run:
/data/ushastry/server/mysql-5_5_29/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /data/ushastry/server/mysql-5_5_29 ; /data/ushastry/server/mysql-5_5_29/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /data/ushastry/server/mysql-5_5_29/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /data/ushastry/server/mysql-5_5_29/scripts/mysqlbug script!

[root@cluster-repo mysql-5_5_29]# ls -l --datadir=/tmp/5529
ls: unrecognized option '--datadir=/tmp/5529'
Try `ls --help' for more information.
[root@cluster-repo mysql-5_5_29]# ls -l /tmp/5529
total 12
drwx------ 2 mysql root  4096 Feb 20 14:11 mysql
drwx------ 2 mysql mysql 4096 Feb 20 14:11 performance_schema
drwx------ 2 mysql root  4096 Feb 20 14:11 test
[root@cluster-repo mysql-5_5_29]#
[root@cluster-repo mysql-5_5_29]# bin/mysqld_safe --no-defaults --basedir=/data/ushastry/server/mysql-5_5_29 --datadir=/tmp/5529 --port=3306 --socket=sock --server-id=1 --tmpdir=/tmp/5529/ --user=mysql &
[1] 13872
[root@cluster-repo mysql-5_5_29]# 130220 14:12:13 mysqld_safe Logging to '/tmp/5529/cluster-repo.err'.
130220 14:12:13 mysqld_safe Starting mysqld daemon with databases from /tmp/5529

[root@cluster-repo mysql-5_5_29]#
[root@cluster-repo mysql-5_5_29]# ps aux|grep mysqld
root     13872  0.3  0.0 106232  1404 pts/0    S    14:12   0:00 /bin/sh bin/mysqld_safe --no-defaults --basedir=/data/ushastry/server/mysql-5_5_29 --datadir=/tmp/5529 --port=3306 --socket=sock --server-id=1 --tmpdir=/tmp/5529/ --user=mysql
mysql    14036  1.6  0.6 448200 39880 pts/0    Sl   14:12   0:00 /data/ushastry/server/mysql-5_5_29/bin/mysqld --no-defaults --basedir=/data/ushastry/server/mysql-5_5_29 --datadir=/tmp/5529 --plugin-dir=/data/ushastry/server/mysql-5_5_29/lib/plugin --user=mysql --server-id=1 --tmpdir=/tmp/5529/ --log-error=/tmp/5529/cluster-repo.err --pid-file=/tmp/5529/cluster-repo.pid --socket=sock --port=3306
root     14054  0.0  0.0 103244   836 pts/0    S+   14:12   0:00 grep mysqld
[root@cluster-repo mysql-5_5_29]#

Btw, I noticed that you are getting error 13 and perror suggest that it is due to permissions..

[root@cluster-repo mysql-5_5_29]# bin/perror 13
OS error code  13:  Permission denied
[19 Feb 2013 12:09] Jigar Dhulla
Hi,

Sorry. Looks like there is some error in my OS itself even yum's mysql isn't working. Thanks.
[19 Feb 2013 12:13] MySQL Verification Team
Thanks for confirming.
I am closing this bug now - please reopen, if needed