MySQL doesn't start

Hi,
I messed something up in my FreeBSD Jail.

Now MySQL doesn't start anymore.

Code:
 cat /var/db/mysql/*.err
110814 19:20:53 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
/usr/local/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110814 19:20:53 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110814 19:20:53 InnoDB: The InnoDB memory heap is disabled
110814 19:20:53 InnoDB: Mutexes and rw_locks use GCC atomic builtins
110814 19:20:53 InnoDB: Compressed tables use zlib 1.2.3
110814 19:20:53 InnoDB: Initializing buffer pool, size = 128.0M
110814 19:20:53 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
110814 19:20:53  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
110814 19:20:53  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
110814 19:20:53  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
110814 19:20:54  InnoDB: Waiting for the background threads to start
110814 19:20:55 InnoDB: 1.1.8 started; log sequence number 0
110814 19:20:55 [ERROR] /usr/local/libexec/mysqld: unknown option '--safe-show-database'
110814 19:20:55 [ERROR] Aborting

110814 19:20:55  InnoDB: Starting shutdown...
110814 19:20:56  InnoDB: Shutdown completed; log sequence number 1595675
110814 19:20:56 [Note] /usr/local/libexec/mysqld: Shutdown complete

110814 19:20:56 mysqld_safe mysqld from pid file /var/db/mysql/famp.fritz.box.pid ended
110814 19:24:11 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
/usr/local/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110814 19:24:11 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110814 19:24:11 InnoDB: The InnoDB memory heap is disabled
110814 19:24:11 InnoDB: Mutexes and rw_locks use GCC atomic builtins
110814 19:24:11 InnoDB: Compressed tables use zlib 1.2.3
110814 19:24:11 InnoDB: Initializing buffer pool, size = 128.0M
110814 19:24:11 InnoDB: Completed initialization of buffer pool
110814 19:24:11 InnoDB: highest supported file format is Barracuda.
110814 19:24:11  InnoDB: Waiting for the background threads to start
110814 19:24:12 InnoDB: 1.1.8 started; log sequence number 1595675
110814 19:24:12 [ERROR] /usr/local/libexec/mysqld: unknown option '--safe-show-database'
110814 19:24:12 [ERROR] Aborting

110814 19:24:12  InnoDB: Starting shutdown...
110814 19:24:13  InnoDB: Shutdown completed; log sequence number 1595675
110814 19:24:13 [Note] /usr/local/libexec/mysqld: Shutdown complete

110814 19:24:13 mysqld_safe mysqld from pid file /var/db/mysql/famp.fritz.box.pid ended
[root@famp /usr/local/etc/rc.d]# mysql_upgrade
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=29912'
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect
FATAL ERROR: Upgrade failed

Regards
bsus
 
First, check if /var/db/mysql is owned by mysql:mysql (do the same for the child dir's and files). If this is ok, try re-installing the tables (mysql_install_db).
 
Hi,

I fixed the permissions for two child files (mysql, test).
Proplem still remains. When I try to
Code:
[root@famp /usr/local]# mysql_install_db
Installing MySQL system tables...
110814 22:56:18 [ERROR] ./libexec/mysqld: unknown option '--safe-show-database'
110814 22:56:18 [ERROR] Aborting

110814 22:56:18 [Note] ./libexec/mysqld: Shutdown complete


Installation of system tables failed!  Examine the logs in
./data for more information.

You can try to start the mysqld daemon with:

    shell> ./libexec/mysqld --skip-grant &

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

    shell> ./bin/mysql -u root mysql
    mysql> show tables

Try 'mysqld --help' if you have problems with paths.  Using --log
gives you a log in ./data 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 ./bin/mysqlbug script!

[root@famp /usr/local]# ./libexec/mysqld --skip-grant &
[1] 77312
[root@famp /usr/local]# 110814 22:56:36 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

110814 22:56:36 [ERROR] Aborting

110814 22:56:36 [Note] ./libexec/mysqld: Shutdown complete

Regards
 
Can you start the db now ? Did you try starting the db with
Code:
mysqld_safe
?
Also, if the
Code:
mysql_install_db
failed, did you try to start the db with --skip-grant-tables ?
 
Code:
jexec 3 /usr/local/bin/bash
[root@famp /]# mysqld_safe
110815 06:55:26 mysqld_safe Logging to '/usr/local/data/famp.fritz.box.err'.
110815 06:55:26 mysqld_safe Starting mysqld daemon with databases from /usr/local/data
110815 06:55:26 mysqld_safe mysqld from pid file /usr/local/data/famp.fritz.box.pid ended
[root@famp /]# /usr/local/etc/rc.d/mysql-server status
mysql is not running.
[root@famp /]# mysql_install_db

FATAL ERROR: Could not find ./bin/my_print_defaults

If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

[root@famp /]# mysql_install_db --skip-grant-tables

FATAL ERROR: Could not find ./bin/my_print_defaults

If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

[root@famp /]# mysqld_safe --skip-grant-tables
110815 06:56:28 mysqld_safe Logging to '/usr/local/data/famp.fritz.box.err'.
110815 06:56:28 mysqld_safe Starting mysqld daemon with databases from /usr/local/data
110815 06:56:28 mysqld_safe mysqld from pid file /usr/local/data/famp.fritz.box.pid ended
[root@famp /]# /usr/local/etc/rc.d/mysql-server status
mysql is not running.
[root@famp /]#

How can I delete MySQL completly from the jail?
Mybe so I could solve - Make reinstall over ports doesn't helps.

Regards
 
The databases shouldn't be stored in /usr/local/. By default they are in /var/db/mysql/.

Please post the relevant MySQL entries from your /etc/rc.conf.
 
Code:
freebsd admin # jexec 3 /usr/local/bin/bash
[root@famp /]# mysql_install_db --base-dir=/usr/local

FATAL ERROR: Could not find ./bin/my_print_defaults

If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

[root@famp /]# cat /etc/rc.conf
hostname="famp.fritz.box"
defaultrouter="192.168.178.4" #your host
network_interfaces="re0" #no inet devices
apache22_enable="YES"
apache22ssl_enable="YES"
accf_http_ready="YES"
mysql_enable="YES"
[root@famp /]#

Regards
 
No need to do anything. Just start MySQL:
Code:
/usr/local/etc/rc.d/mysql-server start
 
Hmm,

Code:
[root@famp /]# /usr/local/etc/rc.d/mysql-server start
Starting mysql.
[root@famp /]# /usr/local/etc/rc.d/mysql-server status
mysql is not running.
[root@famp /]#
 
Ok, do you have a my.cnf somewhere? Is so, remove it. It's not needed, not at first anyway.

Check the existence and permissions of:
Code:
root@intranetz:~#ll -d /var/db/mysql/
drwxr-xr-x  7 mysql  mysql  13 Aug 14 15:31 /var/db/mysql/

Then start it again but add a little extra information:
Code:
sh -x /usr/local/etc/rc.d/mysql-server start

Oh, and go into your jail with:
Code:
jexec <jid> su -
Not sure if it'll help but it should clear up any confusion regarding environment variables, userids, etc.
 
my.cnf removed

Code:
+ harvest_ethernet=YES
+ cron_enable=YES
+ cron_program=/usr/sbin/cron
+ cron_dst=YES
+ cron_flags=''
+ lpd_enable=NO
+ lpd_program=/usr/sbin/lpd
+ lpd_flags=''
+ nscd_enable=NO
+ chkprintcap_enable=NO
+ chkprintcap_flags=-d
+ dumpdev=NO
+ dumpdir=/var/crash
+ savecore_flags=''
+ crashinfo_enable=YES
+ crashinfo_program=/usr/sbin/crashinfo
+ quota_enable=NO
+ check_quotas=YES
+ quotaon_flags=-a
+ quotaoff_flags=-a
+ quotacheck_flags=-a
+ accounting_enable=NO
+ ibcs2_enable=NO
+ ibcs2_loaders=coff
+ sysvipc_enable=NO
+ linux_enable=NO
+ svr4_enable=NO
+ clear_tmp_enable=NO
+ clear_tmp_X=YES
+ ldconfig_insecure=NO
+ ldconfig_paths='/usr/lib/compat /usr/local/lib /usr/local/lib/compat/pkg'
+ ldconfig32_paths=/usr/lib32
+ ldconfig_paths_aout='/usr/lib/compat/aout /usr/local/lib/aout'
+ ldconfig_local_dirs=/usr/local/libdata/ldconfig
+ ldconfig_local32_dirs=/usr/local/libdata/ldconfig32
+ kern_securelevel_enable=NO
+ kern_securelevel=-1
+ update_motd=YES
+ entropy_file=/entropy
+ entropy_dir=/var/db/entropy
+ entropy_save_sz=2048
+ entropy_save_num=8
+ harvest_interrupt=YES
+ harvest_ethernet=YES

+ harvest_p_to_p=YES
+ dmesg_enable=YES
+ watchdogd_enable=NO
+ watchdogd_flags=''
+ devfs_rulesets='/etc/defaults/devfs.rules /etc/devfs.rules'
+ devfs_system_ruleset=''
+ devfs_set_rulesets=''
+ performance_cx_lowest=HIGH
+ performance_cpu_freq=NONE
+ economy_cx_lowest=HIGH
+ economy_cpu_freq=NONE
+ virecover_enable=YES
+ ugidfw_enable=NO
+ bsdextended_script=/etc/rc.bsdextended
+ newsyslog_enable=YES
+ newsyslog_flags=-CN
+ mixer_enable=YES
+ jail_enable=NO
+ jail_list=''
+ jail_set_hostname_allow=YES
+ jail_socket_unixiproute_only=YES
+ jail_sysvipc_allow=NO
+ [ -z '' ]
+ source_rc_confs_defined=yes
+ source_rc_confs
+ local i sourced_files
+ sourced_files=:/etc/rc.conf:
+ [ -r /etc/rc.conf ]
+ . /etc/rc.conf
+ hostname=famp.fritz.box
+ defaultrouter=192.168.178.4
+ network_interfaces=re0
+ apache22_enable=YES
+ apache22ssl_enable=YES
+ accf_http_ready=YES
+ mysql_enable=YES
+ sourced_files=:/etc/rc.conf::/etc/rc.conf.local:
+ [ -r /etc/rc.conf.local ]
+ _rc_conf_loaded=true
+ [ -f /etc/rc.conf.d/mysql ]
+ [ -n '' ]
+ eval echo '$mysql_enable_defval'
+ echo
+ _defval=''
+ [ -n '' ]
+ : YES
+ : NO
+ : /var/db/mysql
+ mysql_user=mysql
+ mysql_limits_args='-e -U mysql'
+ /bin/hostname
+ pidfile=/var/db/mysql/famp.fritz.box.pid
+ command=/usr/sbin/daemon
+ command_args='-c -f /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/famp.fritz.box.pid '
+ procname=/usr/local/libexec/mysqld
+ start_precmd=mysql_prestart
+ start_postcmd=mysql_poststart
+ mysql_install_db=/usr/local/bin/mysql_install_db
+ mysql_install_db_args='--basedir=/usr/local --datadir=/var/db/mysql --force'
+ run_rc_command start
+ _return=0
+ rc_arg=start
+ [ -z mysql ]
+ shift 1
+ rc_extra_args=''
+ _rc_prefix=''
+ eval '_override_command=$mysql_program'
+ _override_command=''
+ command=/usr/sbin/daemon
+ _keywords='start stop restart rcvar '
+ rc_pid=''
+ _pidcmd=''
+ _procname=/usr/local/libexec/mysqld
+ [ -n /usr/local/libexec/mysqld ]
+ [ -n /var/db/mysql/famp.fritz.box.pid ]
+ _pidcmd='rc_pid=$(check_pidfile /var/db/mysql/famp.fritz.box.pid /usr/local/libexec/mysqld )'
+ [ -n 'rc_pid=$(check_pidfile /var/db/mysql/famp.fritz.box.pid /usr/local/libexec/mysqld )' ]
+ _keywords='start stop restart rcvar  status poll'
+ [ -z start ]
+ [ -n '' ]
+ eval 'rc_flags=$mysql_flags'
+ rc_flags=''
+ eval '_chdir=$mysql_chdir' '_chroot=$mysql_chroot' '_nice=$mysql_nice' '_user=$mysql_user' '_group=$mysql_group' '_groups=$mysql_groups'
+ _chdir='' _chroot='' _nice='' _user=mysql _group='' _groups=''
+ [ -n mysql ]
+ eval if [ -x /usr/bin/id '];' then /usr/bin/id '-un;' fi
+ [ -x /usr/bin/id ]
+ /usr/bin/id -un
+ [ mysql = root ]
+ eval 'rc_pid=$(check_pidfile' /var/db/mysql/famp.fritz.box.pid /usr/local/libexec/mysqld ')'
+ check_pidfile /var/db/mysql/famp.fritz.box.pid /usr/local/libexec/mysqld
+ _pidfile=/var/db/mysql/famp.fritz.box.pid
+ _procname=/usr/local/libexec/mysqld
+ _interpreter=''
+ [ -z /var/db/mysql/famp.fritz.box.pid -o -z /usr/local/libexec/mysqld ]
+ [ ! -f /var/db/mysql/famp.fritz.box.pid ]
+ debug 'pid file (/var/db/mysql/famp.fritz.box.pid): not readable.'
+ return
+ rc_pid=''
+ [ start != start ]
+ [ -n mysql_enable -a start != rcvar -a -z '' ]
+ checkyesno mysql_enable
+ eval '_value=$mysql_enable'
+ _value=YES
+ debug 'checkyesno: mysql_enable is set to YES.'
+ return 0
+ eval '_cmd=$start_cmd' '_precmd=$start_precmd' '_postcmd=$start_postcmd'
+ _cmd='' _precmd=mysql_prestart _postcmd=mysql_poststart
+ [ -n '' ]
+ [ -z '' -a -n '' ]
+ [ ! -x /usr/sbin/daemon ]
+ _run_rc_precmd
+ check_required_before start
+ local _f
+ return 0
+ [ -n mysql_prestart ]
+ debug 'run_rc_command: start_precmd: mysql_prestart '
+ eval 'mysql_prestart '
+ mysql_prestart
+ [ ! -d /var/db/mysql/mysql/. ]
+ checkyesno mysql_limits
+ eval '_value=$mysql_limits'
+ _value=NO
+ debug 'checkyesno: mysql_limits is set to NO.'
+ return 1
+ return 0
+ _return=0
+ [ 0 -ne 0 ]
+ check_required_after start
+ local _f _args
+ return 0
+ return 0
+ check_startmsgs
+ [ -n '' ]
+ return 0
+ echo 'Starting mysql.'
+ [ -n '' ]
+ _doit='/usr/sbin/daemon  -c -f /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/famp.fritz.box.pid '
+ [ -n mysql ]
+ _doit='su -m mysql -c '\''sh -c "/usr/sbin/daemon  -c -f /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/famp.fritz.box.pid "'\'
+ [ -n '' ]
+ _run_rc_doit 'su -m mysql -c '\''sh -c "/usr/sbin/daemon  -c -f /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/famp.fritz.box.pid "'\'
+ debug 'run_rc_command: doit: su -m mysql -c '\''sh -c "/usr/sbin/daemon  -c -f /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/famp.fritz.box.pid "'\'
+ eval 'su -m mysql -c '\''sh -c "/usr/sbin/daemon  -c -f /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/famp.fritz.box.pid "'\'
+ su -m mysql -c 'sh -c "/usr/sbin/daemon  -c -f /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/famp.fritz.box.pid "'
+ _return=0
+ [ 0 -ne 0 ]
+ return 0
+ _run_rc_postcmd
+ [ -n mysql_poststart ]
+ debug 'run_rc_command: start_postcmd: mysql_poststart '
+ eval 'mysql_poststart '
+ mysql_poststart
+ local timeout=15
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 15 -gt 0 ]
+ timeout=14
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 14 -gt 0 ]
+ timeout=13
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 13 -gt 0 ]
+ timeout=12
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 12 -gt 0 ]
+ timeout=11
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 11 -gt 0 ]
+ timeout=10
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 10 -gt 0 ]
+ timeout=9
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 9 -gt 0 ]
+ timeout=8
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 8 -gt 0 ]
+ timeout=7
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 7 -gt 0 ]
+ timeout=6
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 6 -gt 0 ]
+ timeout=5
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 5 -gt 0 ]
+ timeout=4
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 4 -gt 0 ]
+ timeout=3
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 3 -gt 0 ]
+ timeout=2
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 2 -gt 0 ]
+ timeout=1
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 1 -gt 0 ]
+ timeout=0
+ sleep 1
+ [ ! -f /var/db/mysql/famp.fritz.box.pid -a 0 -gt 0 ]
+ return 0
+ _return=0
+ return 0
+ return 0
[root@famp /]#
 
Everything in there looks good. If this is a brand new install try to remove the files in /var/db/mysql/. If there's nothing there it'll create all the necessary databases and such automatically.
 
Code:
[root@famp /]# rm -rf /var/db/mysql
[root@famp /]# /usr/local/etc/rc.d/mysql-server start
Starting mysql.
[root@famp /]# /usr/local/etc/rc.d/mysql-server status
mysql is not running.
[root@famp /]#

I think its better to remove the complete jail.
Are there any hints?
Should I remove all jails and set them complete new?

Regards
 
bsus said:
I think its better to remove the complete jail.
Are there any hints?
Should I remove all jails and set them complete new?
I don't see any reason for this. But you might want to try to re-install mysql.
 
I tried this already...

I think that a "restore" would be the easiest way to solve this.
Also would I train setting up the AMP server again ;)
 
Back
Top