Ubuntu MySQL: Job failed to start - mysql

My Google Cloud server HDD space run out. So I've added another mounted HDD where I copied contents of MySQL data (/var/lib/mysql/*). After updating my.cnf when I tried to restart MySQL it fails leaving the following error:
160110 14:10:40 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use$
160110 14:10:40 [Note] Plugin 'FEDERATED' is disabled.
^G/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
160110 14:10:40 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160110 14:10:40 InnoDB: The InnoDB memory heap is disabled
160110 14:10:40 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160110 14:10:40 InnoDB: Compressed tables use zlib 1.2.8
160110 14:10:40 InnoDB: Using Linux native AIO
160110 14:10:40 InnoDB: Initializing buffer pool, size = 128.0M
160110 14:10:40 InnoDB: Completed initialization of buffer pool
160110 14:10:40 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
160110 14:10:41 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use$
160110 14:10:41 [Note] Plugin 'FEDERATED' is disabled.
^G/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
160110 14:10:41 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160110 14:10:41 InnoDB: The InnoDB memory heap is disabled
160110 14:10:41 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160110 14:10:41 InnoDB: Compressed tables use zlib 1.2.8
160110 14:10:41 InnoDB: Using Linux native AIO
160110 14:10:41 InnoDB: Initializing buffer pool, size = 128.0M
160110 14:10:41 InnoDB: Completed initialization of buffer pool
160110 14:10:41 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
160110 14:10:42 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use$
160110 14:10:42 [Note] Plugin 'FEDERATED' is disabled.
^G/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
160110 14:10:42 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160110 14:10:42 InnoDB: The InnoDB memory heap is disabled
160110 14:10:42 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160110 14:10:42 InnoDB: Compressed tables use zlib 1.2.8
160110 14:10:41 InnoDB: Using Linux native AIO
160110 14:10:41 InnoDB: Initializing buffer pool, size = 128.0M
160110 14:10:41 InnoDB: Completed initialization of buffer pool
160110 14:10:41 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
160110 14:10:42 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use$
160110 14:10:42 [Note] Plugin 'FEDERATED' is disabled.
^G/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
160110 14:10:42 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160110 14:10:42 InnoDB: The InnoDB memory heap is disabled
160110 14:10:42 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160110 14:10:42 InnoDB: Compressed tables use zlib 1.2.8
160110 14:10:42 InnoDB: Using Linux native AIO
160110 14:10:42 InnoDB: Initializing buffer pool, size = 128.0M
160110 14:10:42 InnoDB: Completed initialization of buffer pool
160110 14:10:42 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
I've tried chmod 777 and chown mysql:mysql to the mounted folder (/var/www/html/DB/) but the result is same. After using chown, I can even see that the owner is now mysql. So why MySQL is failing to access the folder?
I've seen similar question here but most of the accepted answers are reinstalling MySQL. That's not a solution to me. It's simply bypassing the problem. Any better answer?

Can you check that you have set all your config file where you have to change directory path in my.cnf
Also make sure you have change the profile for mysqld that mean you have to update AppArmor config file so it will get the new directory.
Check this link https://blogs.oracle.com/jsmyth/entry/apparmor_and_mysql
I hope this will work!!

Related

MySQL Daemon failed to start Linux

I have googled a lot about this issue though there are some solution available however I tried all of them and seems that my issue is slightly different.
Can someone pls help me resolve this.
OS: OEL6.5 Linux
MySQL 5.5
MySQL.log:
180625 12:03:50 [Note] Plugin 'FEDERATED' is disabled.
180625 12:03:50 InnoDB: The InnoDB memory heap is disabled
180625 12:03:50 InnoDB: Mutexes and rw_locks use GCC atomic builtins
180625 12:03:50 InnoDB: Compressed tables use zlib 1.2.3
180625 12:03:50 InnoDB: Initializing buffer pool, size = 15.0G
180625 12:03:52 InnoDB: Completed initialization of buffer pool
180625 12:03:52 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
180625 12:03:52 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Error: trying to add tablespace 2113 of name './items_table.ibd'
InnoDB: to the tablespace memory cache, but tablespace
InnoDB: 2113 of name './customer_table.ibd' already exists in the tablespace
InnoDB: memory cache!
Important:
Before starting to play with db files make a dump (mysqldump -A > mydb.sql).
Consider following one of the options below:
Moving items_table.ibd out from the directory tree and restarting mysql will fix the Error.
Recreate MySQL data dir: https://dba.stackexchange.com/questions/103625/how-to-reinitialise-var-lib-mysql-files

Cannot start mySQL "mysqld: Too many arguments (first extra is 'start')."

I want to start mysql but this immediately shows up, I don't realy know how to solve it, can you please help me?
I have Ubuntu 14.04
this is what appears in the terminal.
dyphen#dyphen12-GNU:/etc/mysql$ sudo mysqld start
180510 5:55:25 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
180510 5:55:25 [Warning] Insecure configuration for --secure-file-priv: Location is accessible to all OS users. Consider choosing a different directory.
180510 5:55:25 [Note] mysqld (mysqld 5.5.60-0ubuntu0.14.04.1) starting as process 7158 ...
180510 5:55:25 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
180510 5:55:25 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
180510 5:55:25 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
180510 5:55:25 InnoDB: The InnoDB memory heap is disabled
180510 5:55:25 InnoDB: Mutexes and rw_locks use GCC atomic builtins
180510 5:55:25 InnoDB: Compressed tables use zlib 1.2.8
180510 5:55:25 InnoDB: Using Linux native AIO
180510 5:55:25 InnoDB: Initializing buffer pool, size = 128.0M
180510 5:55:25 InnoDB: Completed initialization of buffer pool
180510 5:55:25 InnoDB: highest supported file format is Barracuda.
180510 5:55:26 InnoDB: Waiting for the background threads to start
180510 5:55:27 InnoDB: 5.5.60 started; log sequence number 1595675
mysqld: Too many arguments (first extra is 'start').
Use --verbose --help to get a list of available options
180510 5:55:27 [ERROR] Aborting
180510 5:55:27 InnoDB: Starting shutdown...
180510 5:55:28 InnoDB: Shutdown completed; log sequence number 1595675
180510 5:55:28 [Note] mysqld: Shutdown complete
llja is right. I made the same mistake. To start mysqld, simply type
mysqld
If a new problem surface, check /var/log/mysql/error.log for ERROR messages.

mysql datadir from old hard drive system does not boot

I´m trying to migrate a mysql database from an old drive which had fedora9 (which did not boot anymore) to an ubuntu 16.04 server.
I copied the /var/lib/mysql folder from the old system to /testdb/mysql in the new system.
I change the owner to mysql:mysql to the new folder and update datadir of my.conf to this new folder, but the mysql server does not boot anymore. I get the following error:
170625 12:44:37 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
170625 12:44:37 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
170625 12:44:37 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
170625 12:44:37 InnoDB: The InnoDB memory heap is disabled
170625 12:44:37 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170625 12:44:37 InnoDB: Compressed tables use zlib 1.2.8
170625 12:44:37 InnoDB: Using Linux native AIO
170625 12:44:37 InnoDB: Initializing buffer pool, size = 128.0M
170625 12:44:37 InnoDB: Completed initialization of buffer pool
170625 12:44:37 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
170625 12:44:38 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
170625 12:44:38 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
170625 12:44:38 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
170625 12:44:38 InnoDB: The InnoDB memory heap is disabled
170625 12:44:38 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170625 12:44:38 InnoDB: Compressed tables use zlib 1.2.8
170625 12:44:38 InnoDB: Using Linux native AIO
170625 12:44:38 InnoDB: Initializing buffer pool, size = 128.0M
170625 12:44:38 InnoDB: Completed initialization of buffer pool
170625 12:44:38 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
170625 12:44:38 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
170625 12:44:38 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
170625 12:44:38 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
170625 12:44:38 InnoDB: The InnoDB memory heap is disabled
170625 12:44:38 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170625 12:44:38 InnoDB: Compressed tables use zlib 1.2.8
170625 12:44:38 InnoDB: Using Linux native AIO
170625 12:44:38 InnoDB: Initializing buffer pool, size = 128.0M
170625 12:44:38 InnoDB: Completed initialization of buffer pool
170625 12:44:38 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
I tried to change all permissions, even 777 to all files (only to try it), but always have the same result.
How can I recover the databases?
I finally found the way to recover the tables, and it is not changing the datadir from my.conf (it didn´t work, even copying the content of the default database that works fine), I copied the folder I want to recover to the default datadir, overwriting all files except mysql.sock and mysql folder.
Then I started the mysql server and it works, but some tables shall to be repaired with
mysqlcheck --repair --all-databases -u root -p
Now everything works fine

Recover DB from ibdata1, ib_logfile0, ib_logfile1 and .frm files

Recently My production server was corrupted due to maintenance shutdown by digital ocean. When we trying to recover our database we couldn't access our droplet. Somehow we managed to recover these (ibdata1, ib_logfile0, ib_logfile1 and some .frm) files. When i copied this files to my new mysql server(in another machine), I could't start the mysql server. I got this output
sudo service mysql restart
mysql stop/waiting
start: Job failed to start
I checked the log file and i got this error,
151019 8:55:27 [Warning] Using unique option prefix myisam-recover instead of $
151019 8:55:27 [Note] Plugin 'FEDERATED' is disabled.
151019 8:55:27 InnoDB: The InnoDB memory heap is disabled
151019 8:55:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151019 8:55:27 InnoDB: Compressed tables use zlib 1.2.8
151019 8:55:27 InnoDB: Using Linux native AIO
151019 8:55:27 InnoDB: Initializing buffer pool, size = 128.0M
151019 8:55:27 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
151019 8:55:27 [ERROR] Plugin 'InnoDB' init function returned error.
151019 8:55:27 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151019 8:55:27 [ERROR] Unknown/unsupported storage engine: InnoDB
151019 8:55:27 [ERROR] Aborting
151019 8:55:27 [Note] /usr/sbin/mysqld: Shutdown complete
151019 8:55:28 [Warning] Using unique option prefix myisam-recover instead of $
151019 8:55:28 [Note] Plugin 'FEDERATED' is disabled.
151019 8:55:28 InnoDB: The InnoDB memory heap is disabled
151019 8:55:28 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151019 8:55:28 InnoDB: Compressed tables use zlib 1.2.8
151019 8:55:28 InnoDB: Using Linux native AIO
151019 8:55:28 InnoDB: Initializing buffer pool, size = 128.0M
151019 8:55:28 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
151019 8:55:28 [ERROR] Plugin 'InnoDB' init function returned error.
151019 8:55:28 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151019 8:55:28 [ERROR] Unknown/unsupported storage engine: InnoDB
151019 8:55:28 [ERROR] Aborting
151019 8:55:28 [Note] /usr/sbin/mysqld: Shutdown complete
151019 8:55:29 [Warning] Using unique option prefix myisam-recover instead of $
151019 8:55:29 [Note] Plugin 'FEDERATED' is disabled.
151019 8:55:29 InnoDB: The InnoDB memory heap is disabled
151019 8:55:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151019 8:55:29 InnoDB: Compressed tables use zlib 1.2.8
151019 8:55:29 InnoDB: Using Linux native AIO
151019 8:55:29 InnoDB: Initializing buffer pool, size = 128.0M
151019 8:55:29 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
151019 8:55:29 [ERROR] Plugin 'InnoDB' init function returned error.
151019 8:55:29 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151019 8:55:29 [ERROR] Unknown/unsupported storage engine: InnoDB
151019 8:55:29 [ERROR] Aborting
151019 8:55:29 [Note] /usr/sbin/mysqld: Shutdown complete
I tried adding innodb_log_file_size= 50331648 as suggested by #akuzminsky
Then I got this error log.
151022 6:54:13 [Warning] Using unique option prefix myisam-recover instead of $
151022 6:54:13 [Note] Plugin 'FEDERATED' is disabled.
151022 6:54:13 InnoDB: The InnoDB memory heap is disabled
151022 6:54:13 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151022 6:54:13 InnoDB: Compressed tables use zlib 1.2.8
151022 6:54:13 InnoDB: Using Linux native AIO
151022 6:54:13 InnoDB: Initializing buffer pool, size = 128.0M
151022 6:54:13 InnoDB: Completed initialization of buffer pool
151022 6:54:13 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 15379293
151022 6:54:13 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Error: space header page consists of zero bytes in file ./toucan/ormcli$
InnoDB: Error: space header page consists of zero bytes in file ./toucan/catego$
InnoDB: Error: space header page consists of zero bytes in file ./toucan/survey$
InnoDB: Error: space header page consists of zero bytes in file ./toucan/compla$
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 15382291
InnoDB: Page directory corruption: infimum not pointed to
151022 6:54:13 InnoDB: Page dump in ascii and hex (16384 bytes):
len 16384; hex 10cfd0d80000000000000000000000000000000000e9e915000800000000001$
InnoDB: End of page dump
151022 6:54:13 InnoDB: Page checksum 282054872, prior-to-4.0.14-form checksum$
InnoDB: stored checksum 282054872, prior-to-4.0.14-form stored checksum 3468306$
InnoDB: Page lsn 0 15329557, low 4 bytes of lsn at page end 15329557
InnoDB: Page number (if stored to page already) 0,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
InnoDB: Page may be a file space header page
10:54:13 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
key_buffer_size=16777216
read_buffer_size=131072
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 346701 K $
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x20)[0x7fa4d90e2f10]
/usr/sbin/mysqld(handle_fatal_signal+0x3d5)[0x7fa4d8fcd175]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7fa4d7d5d340]
/usr/sbin/mysqld(+0x5f058a)[0x7fa4d91e258a]
/usr/sbin/mysqld(+0x56c44e)[0x7fa4d915e44e]
/usr/sbin/mysqld(+0x576137)[0x7fa4d9168137]
/usr/sbin/mysqld(+0x5a5632)[0x7fa4d9197632]
/usr/sbin/mysqld(+0x5a6699)[0x7fa4d9198699]
/usr/sbin/mysqld(+0x591ad3)[0x7fa4d9183ad3]
/usr/sbin/mysqld(+0x542a1a)[0x7fa4d9134a1a]
/usr/sbin/mysqld(+0x511d48)[0x7fa4d9103d48]
/usr/sbin/mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x41)[0x7fa4d8fcf$
/usr/sbin/mysqld(+0x302221)[0x7fa4d8ef4221]
/usr/sbin/mysqld(_Z11plugin_initPiPPci+0x92a)[0x7fa4d8ef821a]
/usr/sbin/mysqld(+0x28ac5b)[0x7fa4d8e7cc5b]
/usr/sbin/mysqld(_Z11mysqld_mainiPPc+0x45b)[0x7fa4d8e815db]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7fa4d739fec5]
/usr/sbin/mysqld(+0x286b18)[0x7fa4d8e78b18]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
Please help me to resolve this.
Thanks in advance.
Note lines in the error log:
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
The actual size of the redo log file differs from the size in MySQL config.
Add this line to my.cnf
innodb_log_file_size= 50331648
If the tablespace is corrupted you'll still have to heal it. But at least MySQL won't stop at this step.

Can't initiate mysql in MAC OS X 10.7.5

I installed MySQL through a package located in MySQL site.
I changed this directory:
/usr/local/mysql-5.5.28-osx10.5-x86/data
For _mysql
However, when I try to do mysqld start, I get the following errors and warnings:
121018 18:04:17 [Warning] Can't create test file /usr/local/mysql-5.5.28-osx10.5-x86/data/homer.lower-test
121018 18:04:17 [Warning] Can't create test file /usr/local/mysql-5.5.28-osx10.5-x86/data/homer.lower-test
121018 18:04:17 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
121018 18:04:17 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
121018 18:04:17 InnoDB: The InnoDB memory heap is disabled
121018 18:04:17 InnoDB: Mutexes and rw_locks use InnoDB's own implementation
121018 18:04:17 InnoDB: Compressed tables use zlib 1.2.3
121018 18:04:17 InnoDB: Initializing buffer pool, size = 128.0M
121018 18:04:17 InnoDB: Completed initialization of buffer pool
121018 18:04:17 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
Any tips on what can be happening?
The easiest thing to do is to install the System Preferences plugin that you get with the download and start/stop MySQL using that. You can set it there to start automatically when the system restarts.