Can't connect to mysql after failing due to low memory - mysql

I have a mysql server running on an EC2 server lamp stack. It was running just fine, but the server ran out of memory and failed. I tried restarting mysqld but kept getting this error:
mysqld dead but subsys locked
So I created a swap file and now I am able to start mysqld, however, I cannot log in with the root user and password. I have searched the web, but couldn't find anything that was similar to my situation. Any Ideas?

I was able to fix the problem by following the instructions here: http://www.howtoforge.com/reset-forgotten-mysql-root-password

Related

Google Cloud SQL instance always in Maintenance status & Binary logs issue

I've had some of Google Cloud SQL MySQL 2nd Gen 5.7 instances with failover replications. Recently I noticed that the one of the instance overloaded with the storage overloaded with binlogs and old binlogs not deleted for some reason.
I tried restart this instance but it wont start since 17 March.
Normal process with binlogs on other server:
Problem server. Binlogs not clearing and server wont start and always under maintenance in the gcloud console.
Also I created one other server with same configuration and not binlogs never clearing. I have already 5326 binlogs here when on normal server I have 1273 binlogs and they are clearing each day.
What I tried with the problem server:
1 - delete it from the Google Cloud Platform frontend. Response: The instance id is currently unavailable.
2 - restart it with the gcloud command. Response: ERROR: (gcloud.sql.instances.restart) HTTPError 409: The instance or operation is not in an appropriate state to handle the request. Same response on any other command which I sent with the gcloud.
Also I tried to solve problem with binlogs to configure with expire_logs_days option, but it seems this option not support by google cloud sql instance.
After 3 days of digging I found a solution. Binlogs must cleared automatically when 7 days past. In 8 day it must clear binlogs. It still not deleted for me and still storage still climbing, but I trust it must clear shortly (today I guess)
As I told - SQL instance always in maintenance and can't be deleted from the gcloud console command or frontend. But this is interesting because I still can connect to the instance with the mysql command like mysql -u root -p -h 123.123.123.123. So, I just connected to the instance, deleted database which unused (or we can just use mysqldump to save current live database) and then I just deleted it. In the mysql logs (I'm using Stackdriver for this) I got a lot of messages like this: 2018-03-25T09:28:06.033206Z 25 [ERROR] Disk is full writing '/mysql/binlog/mysql-bin.034311' (Errcode: -255699248 - No space left on device). Waiting for someone to free space.... Let's me be this "someone".
When I deleted database it restarted and then it up. Viola. And now we have live instance. Now we can delete it/restore database on it/change storage for it.

Xampp Database Replication Setup Error

Scenario
I've been trying to set up mysql database replication on my xampp server but its not been working. I get the following error
and the error logs display the following message.
2017-12-28 10:14:37 10384 [ERROR] Slave I/O: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it). Internal MariaDB error code: 1593
2017-12-28 10:14:37 10384 [Note] Slave I/O thread exiting, read up to log 'FIRST', position 4
I understand what the error is saying but im not sure how to fix it, i've look online and around at various solutions and followed some of what theyve said. (Couldn't follow all some people are using linux or mysql in the command line so i couldnt follow but i tried an alternative).
I've been following this error since im trying to set this all up on xampp:
https://www.youtube.com/watch?v=nfsmnx24gxU
But its pretty outdated. Since i'm using xampp on windows there doesn't seem to be much up-to-date tutorials for this, they all show how to do it through linux terminal but obviously to me this isnt useful.
I'm also not sure how two separate servers are running on xampp in this scenario. Even if i visit "127.0.0.123" and "127.0.0.222" at the top of PhpMyAdmin it still shows that the current database is hosted on "127.0.0.1" so in this sense the replication process is slightly confusing me. Whats even more confusing is that it works flawlessly in the tutorial that i linked earlier.
I'm using the most up-to-date version of xampp, 28-12-2017.
Question
Does anyone know, on the current version of xampp, how to get past this error OR know of a tutorial that would help me set up replication on xampp on a windows computer.

InnoDB: Unable to lock ./ibdata1 error: 35

I'm trying to start MySQL in safe mode but the log file just keeps spitting out:
[ERROR] InnoDB: Unable to lock ./ibdata1 error: 35
[Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
Notes:
I've stopped all mysql processes and have checked using the ps command
I've read this having repeated trouble with MySQL and Snow Leopard - Unable to lock ./ibdata1, error: 35
Just had this issue with MAMP Pro. Couldn't stop or start MySQL. Typed ps aux | grep mysql, then kill [process id] for each line. Then I could successfully launch MySQL again from MAMP Pro.
Strange error codes, both from MySQL and the operating system, can be explained by running a shell command perror which is a part of MySQL distribution. On Linux, for example, perror 35 returns OS error code 35: Resource deadlock avoided. I do not have an OSX system handy to test, but from this:
http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/sys/errno.h
I gather that error 35 is "Resource temporarily unavailable", meaning that some other process (possibly another instance of mysqld?) has already locked the file.
To debug, first I would check if there is another MySQL process running by chance (looks like you already have), and if not, reboot for good measure to make sure there are no strange stale file locks, and then try again.
Somebody has run into this error before, and found a solution:
mysql_install_db, error: 35, on a Mac OS X 10.9.1
I had a similar issue after updating MAMP from 4.x to 5.x
Unfortunately the only way that I could manage to resolve this was by manually removing all of my database files (moving them into another directory) then starting MySQL via MAMP; this seemed to work.
The files in question (for me) were in:
/Library/Application Support/appsolute/MAMP PRO/db/mysql57
All of the files in this directory (except the mysql directory) need moving somewhere else. I was then able to start MySQL.
I realise this isn't a very useful answer for most situations, but if this is a local development environment (like MAMP, as in my case) then I think losing the local databases is probably acceptable.

MYSQL 5.0 Windows 2003 starts but port not available after Windows update

My Windows 2003 server installed updates this morning and since then MYSQL starts but doesn't listen on port 3306. I have searched for a solution but so far nothing has helped.
I get the error: Can't connect to MySQL server on 'localhost' (10061)
I have my firewall switched off. I can see the mysqld process running, I've checked the MYSQL error log and event viewer. I've used netstat and can see that MYSQL is not listening on port 3306.
From various posts about the issues I have tried:
Trying to connect by IP eg. 127.0.0.1
Backing up my my.ini file and re-configuring using the MYSQL config wizard. I have since restored the original file.
Backing up then removing the ibdata1, ib_logfile0, ib_logfile1 files. I have since restored the original files.
Ensuring there is a firewall rule even though my firewall is off.
Working through my ini file to make sure that port 3306 is enabled and enabling TCP/IP connections (I've always used localhost in the past without a problem).
Running mysqladmin to make sure that port 3306 is specified.
Rebooting several times.
Starting my web, MYSQL and other services in various orders in case one service or another was trying to reserve the port for itself.
I'm getting no errors in the MYSQL error log and just a warning in Event Viewer: Changed limits: max_open_files: 2048 max_connections: 1024 table_cache: 507 - which I think is fine.
Thank you for those who took the time to comment.
Miraculously the MYSQL service has now started and is running fine at least until the next re-boot.
I have no idea why it wasn't working or what changed in the environment to make it work as I changed nothing since my original question nor did I restart the service. I suspect another service stalling / interfering with it. If I do get to the bottom of it though I will post it here.

mysql errors on os x yosemite after restart

Over the weekend I started having all kinds of problems with mysql. I upgraded to Yosemite a while ago and was able to get mysql working. But all of a sudden, my computer is shutting down when I put it to sleep, and when I turn it on in the morning, mysql won't start.
In order to fix this over the weekend, I reinstalled mysql via homebrew, which also required porting over my data/ files and updating the permissions correctly – kind of a pain. I'd rather not do that again.
When I try to restart mysql from the command line I get (There is no shsair.local.pid file btw):
ERROR! The server quit without updating PID file (/usr/local/var/mysql/shsair.local.pid)
I eventually got things to work by updating my.cnf to include:
innodb_force_recovery = 6 (I have no idea what that does or if I should keep it)
But just to see if it was working or not, I tried to start and stop mysql with:
mysql.server stop
and it just hangs. I see this same behavior if I try to restart the computer (it hangs for a long time before shutting off, and I assume because it's trying to shut down mysql.
I'm up for trying any changes to configurations, but it is very important I keep the data/ files as I have years of database work in there.
Thanks!