MySQL failed occasionally - mysql

I have experienced MySQL server process exits occasionally. THis is annoying as I have to restart the mysql server. Here is the log I found:
160409 01:49:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160409 1:49:44 [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.
160409 1:49:44 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
160409 1:49:44 [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.
160409 1:49:44 [Note] /usr/sbin/mysqld (mysqld 5.5.47-0ubuntu0.14.04.1-log) starting as process 26120 ...
160409 1:49:44 [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.
160409 1:49:44 [Note] Plugin 'FEDERATED' is disabled.
160409 1:49:44 InnoDB: The InnoDB memory heap is disabled
160409 1:49:44 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160409 1:49:44 InnoDB: Compressed tables use zlib 1.2.8
160409 1:49:44 InnoDB: Using Linux native AIO
160409 1:49:44 InnoDB: Initializing buffer pool, size = 128.0M
160409 1:49:44 InnoDB: Completed initialization of buffer pool
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
160409 1:49:44 InnoDB: Retrying to lock the first data file
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 11

The error message would lead me to checking exactly that first: You might have multiple MySQL instances running at the same time, possibly spread among multiple users.

Related

MySQL running in safe mode but not in normal mode. Can't find file: './mysql/plugin.frm' (errno: 13)

My server accidentally got hard rebooted yesterday and after that the MySQL service isn't starting.
On running sudo service mysql status
the response was stuck at mysql stop/waiting
On running mysqld --verbose this is the response I got
200305 12:47:59 [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.
200305 12:47:59 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
200305 12:47:59 [Note] mysqld (mysqld 5.5.47-0ubuntu0.14.04.1-log) starting as process 2536 ...
200305 12:47:59 [Warning] Can't create test file /var/lib/mysql/ip-172-31-12-215.lower-test
200305 12:47:59 [Warning] Can't create test file /var/lib/mysql/ip-172-31-12-215.lower-test
200305 12:47:59 [Warning] One can only use the --user switch if running as root
200305 12:47:59 [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.
200305 12:47:59 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
200305 12:47:59 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
200305 12:47:59 InnoDB: The InnoDB memory heap is disabled
200305 12:47:59 InnoDB: Mutexes and rw_locks use GCC atomic builtins
200305 12:47:59 InnoDB: Compressed tables use zlib 1.2.8
200305 12:47:59 InnoDB: Using Linux native AIO
200305 12:47:59 InnoDB: Initializing buffer pool, size = 1.0G
200305 12:47:59 InnoDB: Completed initialization of buffer pool
200305 12:47:59 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.
Currently I can run mysql in safe mode but I'm not sure if there are any issue's in doing that and since this is in production I can't play around with different solutions which would lead to a longer downtime.
TIA
You seems to have upgraded your MySQL server and forgot to run mysql_upgrade
and this is what the error says in your error log.
200305 12:47:59 [ERROR] Can't open the mysql.plugin table. Please run
mysql_upgrade to create it.
in your terminal just run with sudo if needed :
mysql_upgrade

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

Ubuntu MySQL: Job failed to start

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!!

Really frustrated by MySql on start up server

I've been trying to figure out this problem for like two days straight, please help.
I'm relatively a noobie, so please bear with me...
I installed MySql, latest version, using the dumbest way, i.e. dmg file, and also workbench from MySql site.
For the very first time, I used system preference to start the server, everything worked out fine. Then, I tried to create the sample database by using the sample scheme and insert statement files from MySql site. But when I tried to execute those two files, I was prompted for entering password, I had no idea what's going on at that moment, so I closed everything, Googled about how to set up my own password for the root user account for MySql, and used mysqldadmin setpassword... something like that to reset the root password.
Then, the nightmare starts... Since then, no matter which method I tried to use to start up the server, no luck, i.e. system preference, manually. (I do have the PATH environment variable set up correctly btw).
So, here're the two errors I'm getting,
if I just use sudo mysqld:
2015-02-10 20:45:58 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-02-10 20:45:58 49381 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.6.23-osx10.8-x86_64/data/ is case insensitive
2015-02-10 20:45:58 49381 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2015-02-10 20:45:58 49381 [ERROR] Aborting
2015-02-10 20:45:58 49381 [Note] Binlog end
2015-02-10 20:45:58 49381 [Note] mysqld: Shutdown complete
if I tried this sudo mysqld -u root -p mypassword:
2015-02-10 20:10:22 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-02-10 20:10:22 48437 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.6.23-osx10.8-x86_64/data/ is case insensitive
2015-02-10 20:10:22 48437 [Note] Plugin 'FEDERATED' is disabled.
2015-02-10 20:10:22 48437 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-02-10 20:10:22 48437 [Note] InnoDB: The InnoDB memory heap is disabled
2015-02-10 20:10:22 48437 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-02-10 20:10:22 48437 [Note] InnoDB: Memory barrier is not used
2015-02-10 20:10:22 48437 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-02-10 20:10:22 48437 [Note] InnoDB: Using CPU crc32 instructions
2015-02-10 20:10:22 48437 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-02-10 20:10:22 48437 [Note] InnoDB: Completed initialization of buffer pool
2015-02-10 20:10:22 48437 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2015-02-10 20:10:22 48437 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-02-10 20:10:22 48437 [Note] InnoDB: Retrying to lock the first data file
I try to make some config change in my.cnf file, but I can't even find it under my /etc/ directory...
Any help would be extremely appreciated, I'm really starting to hate myself... T.T
p.s. when I tried using mysqld-safe, it looks like the server has been started, but in the workbench, it clearly says the server is still stopped...