Saturday, November 25, 2017

MySQL server fails to start

>PROBLEM

After server reboot MySQL fails to start.
For instance:
  /etc/init.d/mysql restart
or
  service mysql stop
  service mysql start
 
Returns "failed" message.


>SOLUTION

1. Create data backup:
  cp -R /var/lib/mysql /var/lib/mysql_171115

2. Run the following cmds:
  chown -R mysql:mysql /var/lib/mysql
  mysql_install_db --user=mysql -ldata=/var/lib/mysql/

The last cmd output may show you the reason.
- Example:
  root@setgetsrv:/home/alsdias/dev/scripts# mysql_install_db --user=mysql -ldata=/var/lib/mysql/
  Installing MySQL system tables...
  171125 12:02:54 [Warning] The syntax '--log' is deprecated and will be removed in a future release. Please use '--general-log'/'--general-log-file' instead.
  171125 12:02:54 [Warning] The syntax '--log' is deprecated and will be removed in a future release. Please use '--general-log'/'--general-log-file' instead.
  171125 12:02:54 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
  171125 12:02:54 [Note] /usr/sbin/mysqld (mysqld 5.5.55-0+deb7u1-log) starting as process 12458 ...
  171125 12:02:54 [ERROR] /usr/sbin/mysqld: unknown variable 'log_slow_verbosity=query_plan'
  171125 12:02:54 [ERROR] Aborting

3. Solving.
- The output shows issue with:
log_slow_verbosity = query_plan
- then, comment the line:
#log_slow_verbosity = query_plan

>ENV
debian whezzy
MySQL 5.X

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...