mariadb will not start following a power cut - mysql

Everything was fine until a power cut and now mariadb will not start. the below is logged in /var/log/mariadb/mariadb.log.
200927 18:01:15 mysqld_safe Starting mysqld daemon with databases
from /var/lib/mysql /usr/libexec/mysqld: symbol lookup error:
/usr/libexec/mysqld: undefined symbol:
_ZN14JOIN_CACHE_BNL28get_lext_candidate_for_ma|chEv
200927 18:01:15 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
Regards
Matt

I've managed to solve this, but not fully sure how.
I did have other issues reported originally as warning:
Found row where the auto_increment column has the value 0
client is using or hasn't closed the table properly
I ran
myisamchk -s /var/lib/mysql//.MYI
myisamchk -r --update-state /var/lib/mysql//.MYI
I did try mysqlcheck first but it would not work as the service was not up.
It appears all I needed to do afterward was another system reboot and that cleared the last error.
Regards
Matt

Related

MySQL on OSX Sierra can't start: The server quit without updating PID file

Several problems with mysql since last Sierra Update.
Reinstalled several times with brew or mysql dmg and followd many many "solutions" on SO.
Finally it worked but after a Mac Crash, I face the same problem.
MySql won't start from preference panel
Mysql won't start from terminal: Can't connect through /tmp/mysql.sock...of course, mysqld is not running
trying to start mysqld:
sudo /usr/local/mysql/support-files/mysql.server start
ERROR! The server quit without updating PID file (/usr/local/mysql/data/My-iMac.local.pid)
sudo /usr/local/mysql/bin/mysqld several errors and shutdown
a bit stuck
Just tried this
sudo /usr/local/mysql/bin/mysqld_safe
mysqld_safe Logging to '/usr/local/mysql/data/My-iMac.local.err'.
Starting mysqld daemon with databases from /usr/local/mysql/data
mysqld_safe mysqld from pid file /usr/local/mysql/data/My-iMac.local.pid ended
And now looking at error log, the explanation is clear:
tail /usr/local/mysql/data/My-iMac.local.err
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
So I added in my.cnf
[mysqld]
innodb_force_recovery = 1
and now it starts!
It was probably due to previous Mac Crash
In my case the owner of the data folder was changed after an OS update.
After fixing this with …
sudo chown -R mysql /usr/local/mysql/data
… everything worked like a charm again.
Oh, I feel your pain. I've had this happen many times. Stopping the processes didn't always work. To solve this I simply went into System Preferences and MySQL... stop the process from there and try to restart.

How to solve InnoDB: Unable to lock ./ibdata1 mysql error?

2016-03-14 02:30:29 58150 [ERROR] InnoDB: Unable to lock ./ibdata1,
error: 35 2016-03-14 02:30:29 58150 [Note] InnoDB: Check that you do
not already have another mysqld process using the same InnoDB data or
log files.
First, list MySQL processes using the ps command:
ps aux | grep mysql
And then kill the process
sudo kill 56311
Believe it or not, the solution is elsewhere. The problem stems from AppArmor misconfiguration apparently.
So just do:
$ apt install apparmor-profiles
and then restart MySQL (notice how fast it'll restart).
I noticed a file missing related to AppArmor when doing:
$ systemctl status mysql.service
Voila.
It should say "There is another solution: the problem might be AppArmor". If you do not see an entry in /var/log/apport.log, then probably AppArmor is not the problem.
An intriguing solution, however.

MySQL privilege tables

I downgraded from 5.6 to 5.5 and now I can't start mysql. Log files show the following:
50421 12:11:10 [ERROR] /usr/sbin/mysqld: Incorrect information in file: './mysql/proxies_priv.frm'
150421 12:11:10 [ERROR] Fatal error: Can't open and lock privilege tables: Incorrect information in file: './mysql/proxies_priv.frm'
I've done the following to try and resolve but no joy:
chgrp -R mysql /var/lib/mysql
chown -R mysql /var/lib/mysql
and I've also tried the following:
mysql_install_db --user=mysql --ldata=/var/lib/mysql
Which gives this error message:
Installing MySQL system tables...
150421 12:18:01 [ERROR] /usr/sbin/mysqld: Incorrect information in file: './mysql/tables_priv.frm'
ERROR: 1033 Incorrect information in file: './mysql/tables_priv.frm'
I have Googled the problem for about an hour now and am still struggling. Any help appreciated.
I dealt with this by first purging mysql using:
sudo apt-get purge mysql-server-<version>
Then I deleted everything in/var/lib/mysql and ran
sudo apt-get install mysql-server-<version>
I've recently had to deal with this problem as well. Before an upgrade, it's always a good idea to backup the mysql system tables. That way, if you need to rollback, you can get yourself back to a good state.
That being said, here we are. Try this:
1. rm -rf /var/lib/mysql/mysql/* (As suggested by user3392517)
2. mysql_install_db --user=mysql --ldata=/var/lib/mysql
3. start mysqld
4. mysql_upgrade --force
As with most errors that takes day or more to resolve i resorted to extreme measures:
rm -rf /var/lib/mysql/mysql/*
Fixed the problem.
Note: Data loss did occur, but this a development server so I did not care.
Delete the file as root or sudo
rm /var/lib/mysql/mysql/proxies_priv.frm
Then restart MySQL.
I didn't lose any data this way.

MySQL on ubuntu 12.04 won't run after MySQL Workbench installed

Recently I installed MySQL Workbench 6.2 and used it to create ER diagrams of the MySQL 5.5.41 databases I'm working with on Ubuntu 12.04. Everything worked fine until I restarted Ubuntu and suddenly mysql was no longer running. Running mysqld from the command line results in this:
150216 12:50:37 [ERROR] Can't read from messagefile '/usr/share/mysql/english/errmsg.sys'
150216 12:50:37 [Warning] Can't create test file /var/lib/mysql/euler.lower-test
150216 12:50:37 [Warning] Can't create test file /var/lib/mysql/euler.lower-test
mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13)
150216 12:50:37 [ERROR] Aborting
150216 12:50:37 [Note]
The file /usr/share/mysql/english/errmsg.sys exists, owned by root, with permissions 644. The directory /var/lib/mysql exists, owned by mysql, with permissions 700.
I'm guessing that the installation of Workbench changed something (maybe config files) so that mysql is no longer working, but after a fair amount of Internet research, I have not discovered how to solve this problem. Any help will be greatly appreciated.
Seems like file permission problem. Try running mysqld again using sudo
If this doesn't help, maybe you shouldn't be starting it directly via mysqld. Check if the installer package added a service
sudo service --status-all | grep mysql
And if one exist, use it to start mysql, typically:
sudo service mysqld start
Also don't forget to check if mysqld is already running. If so you can't start duplicate process. I know this sound silly but has happened to me before
ps -ef | grep mysqld

Why do I get "MySQL is not running but lock exists"?

I am getting this error
mysql is not running but lock exist
when I am checking the status of MySQL server. I have removed the lock files using following command:
rm /var/lock/subsys/mysql
but still I am getting same error.
Can anyone provide any input on this.
try using the unix lsof command to see which program has the lock
lsof | grep mysql
EDIT:in fact, run lsof on the lock itself
lsof /var/lock/subsys/mysql
I had the same error. It started after an unexpected server reboot. I saw there is a default /etc/my.cnf file which is not in use for my installation. The issue resolved when it renamed my.cnf as my.cnf_old
For this similar error:
service mysql status ERROR! MySQL is not running, but lock file
(/var/lock/subsys/mysql) exists
Follow these steps:
rm /var/lock/subsys/mysql rm:
remove regular empty file
/var/lock/subsys/mysql? y
Press y
/etc/init.d/mysql start.
If the error occurs again after starting MYSQL
then execute ps -ef | grep mysql
Kill all processes of MySQL and repeat steps 1 & 2.
I know this post is a quite old, but I like to make notes on the ones that work for issue that I've experienced recently. I was getting the following message, which lead me here:
service mysql status ERROR! MySQL is not running, but lock file
(/var/lock/subsys/mysql) exists
These are the steps that fixed my issues:
mv /etc/my.cnf /etc/my.cnf_old
rm /var/lock/subsys/mysql
/etc/init.d/mysql start
Starting MySQL.210921 16:46:28 mysqld_safe Logging to '/var/lib/mysql/server001.err'.
210921 16:46:28 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql. SUCCESS!