BLACKBELT

Fedora MySQL

Authored by Corey Ballou

3 Comments

Fedora 16 MySQL 5.5.25a-1 Installation Error and Fix

I have faced a recurring problem these last few weeks with the installation of MySQL 5.5.25a-1 via the Remi repository on multiple machines. Below is an example of the error encountered during installation in /var/log/messages:

Jul 29 01:19:13 mysqld-prepare-db-dir[749]: Initializing MySQL database
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: Installing MySQL system tables...
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: ERROR: 1005  Can't create table 'tmp_db' (errno: 13)
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: 120729  1:19:13 [ERROR] Aborting
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: 120729  1:19:13 [Note] /usr/libexec/mysqld: Shutdown complete
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: Installation of system tables failed!  Examine the logs in
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: /var/lib/mysql for more information.
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: You can try to start the mysqld daemon with:
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: shell> /usr/libexec/mysqld --skip-grant &
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: and use the command line tool /usr/bin/mysql
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: to connect to the mysql database and look at the grant tables:
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: shell> /usr/bin/mysql -u root mysql
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: mysql> show tables
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: Try 'mysqld --help' if you have problems with paths.  Using --log
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: gives you a log in /var/lib/mysql that may be helpful.
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: Please consult the MySQL manual section
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: 'Problems running mysql_install_db', and the manual section that
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: describes problems on your OS.  Another information source are the
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: MySQL email archives available at http://lists.mysql.com/.
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: Please check all of the above before mailing us!  And remember, if
Jul 29 01:19:13 mysqld-prepare-db-dir[749]: you do mail us, you MUST use the /usr/bin/mysqlbug script!
Jul 29 01:19:13 systemd[1]: mysqld.service: control process exited, code=exited status=1
Jul 29 01:19:13 systemd[1]: Unit mysqld.service entered failed state.
Jul 29 01:21:05 mysqld_safe[837]: 120729 01:21:05 mysqld_safe Logging to '/var/log/mysqld.log'.
Jul 29 01:21:05 mysqld_safe[837]: 120729 01:21:05 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Jul 29 01:21:05 mysqld_safe[837]: 120729 01:21:05 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Jul 29 01:21:06 systemd[1]: mysqld.service: control process exited, code=exited status=1
Jul 29 01:21:06 systemd[1]: Unit mysqld.service entered failed state.

This log file was proceeded by more errors found in /var/log/mysqld.log:

120729 01:40:10 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120729  1:40:10 [Note] Plugin 'FEDERATED' is disabled.
120729  1:40:10 InnoDB: The InnoDB memory heap is disabled
120729  1:40:10 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120729  1:40:10 InnoDB: Compressed tables use zlib 1.2.5
120729  1:40:10 InnoDB: Using Linux native AIO
^G/usr/libexec/mysqld: Can't create/write to file '/tmp/ibaIztCF' (Errcode: 13)
120729  1:40:10  InnoDB: Error: unable to create temporary file; errno: 13
120729  1:40:10 [ERROR] Plugin 'InnoDB' init function returned error.
120729  1:40:10 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120729  1:40:10 [ERROR] Unknown/unsupported storage engine: InnoDB
120729  1:40:10 [ERROR] Aborting

The Fix

Ultimately, the issue is caused by the variable PrivateTmp being set in /lib/systemd/system/mysqld.service. This variable is supposed to be for the Fedora 17 targeted release and isn’t compatible with Fedora 16. To fix, simply comment out the line PrivateTmp=true in the file /lib/systemd/system/mysqld.service.

After commenting out the line, you should run systemctl --system daemon-reload to pick up on the changes. You’re now good to start MySQL the right way!

systemctl start  mysqld.service

Lastly, you might want to ensure that MySQL auto-starts on boot:

systemctl enable mysqld.service

If you’re interested in specifics, you can read the comments section in this bug report.

Author: Corey Ballou

Corey Ballou is the CEO of POP.co. Whether you're a student, young professional, entrepreneur, startup, or small business, you can be up and online fast with your own custom domain, email, and webpage on POP. Corey is a professional PHP developer by trade, specializing in custom web applications development for startups, small businesses, and agencies. Follow Corey on Twitter @cballou.

  • Brynjar

    Thank you!! Saved me! :-)

  • Tristan

    Oh God, you made my day!

  • rajkumar

    still i got mysql error in fedora 15

    In mysqld.log file :
    fatal error: can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist

    in message log file :
    mysqld.service control process exited code=exited status=209 in fedora