Deprecated: Hook custom_css_loaded is deprecated since version jetpack-13.5! Use WordPress Custom CSS instead. Jetpack no longer supports Custom CSS. Read the WordPress.org documentation to learn how to apply custom styles to your site: https://wordpress.org/documentation/article/styles-overview/#applying-custom-css in /srv/www/srvfail.com/public_html/wp-includes/functions.php on line 6078
MySQL Archives ⋆ Page 2 of 2 ⋆ SysAdminStuff

MySQL failing to start with message “Can’t find file: ‘./mysql/plugin.frm’ (errno: 23)”

This is a repost of a post from an old blog, made on December 28, 2013, that used to be on:

http://adminramble.com/mysql-failing-start-message-cant-find-file-mysqlplugin-frm-errno-23/

Original post:

Recently I had a problem, where MySQL service was failing to start.
When tailing the MySQL log the following would be recorded while service was being started.

131224 06:04:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 23)
131224 6:04:53 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
/usr/libexec/mysqld: Can't create/write to file '/tmp/ibqcFQMW' (Errcode: 23)
131224 6:04:53 InnoDB: Error: unable to create temporary file; errno: 23
131224 6:04:53 [ERROR] Plugin 'InnoDB' init function returned error.
131224 6:04:53 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
131224 6:04:53 [ERROR] Can't create IP socket: Too many open files in system
131224 6:04:53 [ERROR] Aborting

131224 6:04:53 [Note] /usr/libexec/mysqld: Shutdown complete

131224 06:04:53 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

Now, the message ‘Can’t find file: ‘./mysql/plugin.frm’ (errno: 23)‘ at the begging of the startup process might make you think that the problems is a missing file, but you can see that at the end of a startup process  this message is logged[ERROR] Can’t create IP socket: Too many open files in system.

This suggest that there is a problem with the number of files that is open on the system.
You can confirm this by using a perror utility, which prints system error messages.

If we check the error number 23, which is reported in the error message, we see that the cause of the failure is not a missing file, but that the file can’t be open because to many file handles are in use.

# perror 23
OS error code 23: Too many open files in system

You can check the current maximum number of file descriptors by checking the fs.file-max value in /etc/sysctl.conf, or use the sysctl command to check the current value.

# sysctl -a | grep file-max
 fs.file-max = 65536

To increase the maximum number of file handlesm you can edit /etc/sysctl.conf, change the value of fs.file-max to 200000 or some other value higher then the one you currently have, and then run sysctl -p to apply the new value to the system.

Now, after the file handle number has been increased, you should be able to start the MySQL service normally.

How to install MySQL through YaST

This is a repost of a post from an old blog, made on January 9, 2012, that used to be on:

http://adminramble.com/install-mysql-yast/

Original post:

I was looking into Novell Service Desk as solution for our Help-desk department today, so i decided to test it by installing it on a single machine together with a MySQL server to act as its database. It’s been a few years since the last time I installed MySQL, last few years I’m mostly working with Informix and MS SQL.

I just wanted it installed as soon as possible so I decided to install the it through YaST thinking it would be faster, but neglected the fact that YaST scatters the installation through several directories so I spend some time locating the files. So this are the short instructions for those who decided to do it with YaST. I was installing on SUSE Linux Enterprise Server 11 SP1

HOW TO INSTALL MYSQL THROUGH YAST ON SLES 11
  1. Open YaST(just type yast in terminal)>Software>Software management(use Tab button to move between sections), or go straight to Install Software on main menu if you’re working through GUI
  2. In the search filed type mysql and press Enter or Search
  3. Select mysql package, mysql-client will be selected also automatically also, and press Accept to install them.
    (mysql user and mysql group will be created automatically, so you don’t need to do that)If you want to find out where did YaST installed all the files, you can do that either through the terminal with rpm -qal mysql command, or if you’re working through the GUI by opening YaST, typing mysql i search box and selecting mysql package. On the File List tab you can see where all the files are installed.

  4. Edit the /etc/my.cnf file, by adding user=mysql after the [mysqld]
    your file should look something like this:

    [mysqld]
     user = mysql
  5. Crate a mysql database with the following command:
    /usr/bin/mysql_install_db –user=mysql
  6. Start your server with:
    /usr/bin/mysqld_safe –user=mysql &
  7. Check if the server is running with:
    /usr/bin/mysqladmin version
    You should get information about the software version.
  8. Connect to your MySQL server with:
    /usr/bin/mysql -u root
    You should get the mysql> prompt if everything is okay.

 

There are other ways to install MySQL besides YaST, if you would like to install MySQL from source you can check this blog

MySQLTuner Couldn’t find mysqladmin in your $PATH

If you try to run MySQLTuner on a default RHEL/CentOS 7 minimal install, you will receive an error due to “which” command not being found.

In order to resolve the error you need to add “which” to your CentOS/RHEL installation, or use the “–mysqladmin” switch to point to mysqladmin executable when running mysqltuner.pl.

When you try to execute MySQLTuner, you will receive a message like this:

# perl mysqltuner.pl
Can't exec "which": No such file or directory at mysqltuner.pl line 905 (#1)
(W exec) A system(), exec(), or piped open call could not execute the
named program for the indicated reason. Typical reasons include: the
permissions were wrong on the file, the file wasn't found in
$ENV{PATH}, the executable in question was compiled for another
architecture, or the #! line in a script points to an interpreter that
can't be run for similar reasons. (Or maybe your system doesn't support
#! at all.)

Use of uninitialized value $mysqladmincmd in scalar chomp at mysqltuner.pl line
907 (#1)
(W uninitialized) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe it was a mistake.
To suppress this warning assign a defined value to your variables.

To help you figure out what was undefined, perl will try to tell you
the name of the variable (if any) that was undefined. In some cases
it cannot do this, so it also tells you what operation you used the
undefined value in. Note, however, that perl optimizes your program
anid the operation displayed in the warning may not necessarily appear
literally in your program. For example, "that $foo" is usually
optimized into "that " . $foo, and the warning will refer to the
concatenation (.) operator, even though there is no . in
your program.

Use of uninitialized value $mysqladmincmd in -e at mysqltuner.pl line 908 (#1)
Use of uninitialized value $mysqladmincmd in -e at mysqltuner.pl line 913 (#1)
[!!] Couldn't find mysqladmin in your $PATH. Is MySQL installed?

If you check the reported lines in mysqltuner.pl file, you will see that reported variable mysqladmincmd is found by looking for path of mysqladmin with “which mysqladmin” command.

# sed -n '905p;908p;913p' mysqltuner.pl
        $mysqladmincmd = `which mysqladmin`;
    if ( !-e $mysqladmincmd && $opt{mysqladmin} ) {
    elsif ( !-e $mysqladmincmd ) {

You can install “which” with following command.

yum -y install which

After installing the rpm, you will be able to execute mysqltuner.pl file.

Alternative to installing “which” is to run MySQLTuner with “–mysqladmin” switch and define the path to mysqladmin executable.

# perl mysqltuner.pl --help
   MySQLTuner 1.6.0 - MySQL High Performance Tuning Script
   Bug reports, feature requests, and downloads at http://mysqltuner.com/
   Maintained by Major Hayden (major@mhtx.net) - Licensed under GPL

   Important Usage Guidelines:
      To run the script with the default options, run the script without arguments
      Allow MySQL server to run for at least 24-48 hours before trusting suggestions
      Some routines may require root level privileges (script will provide warnings)
      You must provide the remote server's total memory when connecting to other servers

   Connection and Authentication
      --host     Connect to a remote host to perform tests (default: localhost)
      --socket     Use a different socket for a local connection
      --port         Port to use for connection (default: 3306)
      --user     Username to use for authentication
      --pass     Password to use for authentication
      --mysqladmin   Path to a custom mysqladmin executable
      --mysqlcmd     Path to a custom mysql executable

      --noask              Dont ask password if needed

   Performance and Reporting Options
      --skipsize           Don't enumerate tables and their types/sizes (default: on)
                           (Recommended for servers with many tables)
      --skippassword       Don't perform checks on user passwords(default: off)
      --checkversion       Check for updates to MySQLTuner (default: don't check)
      --forcemem     Amount of RAM installed in megabytes
      --forceswap    Amount of swap memory configured in megabytes
      --passwordfile Path to a password file list(one password by line)
   Output Options:
      --silent             Don't output anything on screen
      --nogood             Remove OK responses
      --nobad              Remove negative/suggestion responses
      --noinfo             Remove informational responses
      --debug              Print debug information
      --dbstat             Print database information
      --idxstat            Print index information
      --nocolor            Don't print output in color
      --buffers            Print global and per-thread buffer values
      --outputfile   Path to a output txt file

      --reportfile   Path to a report txt file

      --template     Path to a template file

On CentOS 7 path to mysqladmin executable is “/usr/bin/mysqladmin”.

This is an example of a command which runs MySQL tuner, by manually specifying MySQL user and password, and path to mysqladmin executable.

perl mysqltuner.pl --user root --pass yourpassword --mysqladmin /usr/bin/mysqladmin