WAMPServer crashed on Windows 10 - how can I backup all MySQL databases? - mysql

WAMPServer won't start up any services for some reason (worked fine until 2 weeks ago -- nothing I can think of that changed, though wouldn't be surprised if Windows 10 forced some update) so I'm planning to uninstall and then reinstall. Before I do, I want to backup my content so that I can restore it once I get the new version installed from scratch.
I have already zipped the wamp64\www folder and now I'm trying to do mysqldump, but MySQL won't even start.
My question has two parts:
How can I start MySQL service on Windows 10 home (no group policies or any such in-depth admin capabilities) when it will not start? I've tried opening services.msc and manually restarting -- it just doesn't do anything. There is no error.
Is there a way to save all my MySQL databases in one go without launching MySQL?

On my system database they are stored in C:\Program Files (x86)\WampServer\bin\mysql\mysql5.1.53\data.
You can try to start mysql locally with an executable on wamp\bin\mysql\mysql-version\bin.
Maybe your wampp won't start because another application is using the same port?
You can view running port on Command Prompt with:
C:\> netstat -a -b
-a This switch displays active TCP connections, TCP connections with the listening state, as well as UDP ports that are being listened to.
-b This netstat switch is very similar to the -o switch listed below, but instead of displaying the PID, will display the process's actual file name. Using -b over -o might seem like it's saving you a step or two but using it can sometimes greatly extend the time it takes netstat to fully execute.
You can search a specific port with :
netstat -aon | find "[PORT]"
-o A handy option for many troubleshooting tasks, the -o switch displays the process identifier (PID) associated with each displayed connection. See the example below for more about using netstat -o.
-n Use the -n switch to prevent netstat from attempting to determine host names for foreign IP addresses. Depending on your current network connections, using this switch could considerably reduce the time it takes for netstat to fully execute.
More Information

Related

Can't SSH to Google Cloud VM After Installing MySQL

I'm trying to set up a small blog server on Google Cloud Platform using the free tier f1.micro instance. I'm using Ubuntu 20.04 LTS as the base image (Ubuntu is the only Linux distro that I'm at all familiar with), though I tried 20.10. Everything works normally until I install MySQL. This is the guide that I'm following. After each failure, I deleted the VM and started with a fresh one.
These are the VM settings:
In addition to the steps listed in the guide, I also tried adding ssh to ufw, just in case.
sudo ufw allow ssh
sudo ufw enable
I also tried running this prior to installing MySQL, based on this article after failing the first couple of times.
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get dist-upgrade
Once I try installing mysql-server the ssh prompt hangs here:
I've tried reconnecting immediately and I've tried waiting overnight, but I always get stuck here when I try to connect again (it stays like this for a very long time before failing):
I experienced a similar issue with a MySQL Instance in GCP, the first issue was related with the type of the VM instance I used, I had a f1-micro machine type on this VM Instance and suddenly I wasn’t able to access the ssh. As this type of VM Instance has only 0.6GB of memory, it became out of memory soon, I changed it to a e2-medium that is value by default and it resolved my problems this time.
As the Instance was out of memory the services in the instance started to fail, it was the reason that I can't access my instance.
At another time I started again with similar issues, but this time, the problem was the disk, I only had 10 GB and there was a process filling my disk, when a partition was out of space, the instance started to fail again.
I only resized my disk, now my instance disk is 20GB and is working fine.
Having said that, I suggest increasing your resources per your convenience to enhance your performance, because to have the problems you described is a good indicator that your existing machine type is not a good fit for your workloads you run on that instance.
So, I suggest to change the machine type to adjust your memory and you can follow the next steps for these tasks please visit the following link to get further information about it.
Changing a machine type
1.- Go to the VM Instances page.
2.- In the Name column, click your instance.
From the instance details page, complete the following steps:
a) Click the Stop button to stop the instance, if you have not stopped it yet.
b) After the instance stops, click the Edit button at the top of the page.
c) Under the Machine configuration section, select the machine type you want to use, or create a custom machine type to increase only the Memory.
d) Save your changes and start again your VM Instance.
You can resize your disk following this guide or with the following command:
gcloud compute disks resize DISK_NAME --size DISK_SIZE
Or with the Console:
Go to the Disks page to see a list of zonal persistent disks in your project.
Click the name of the disk that you want to resize.
On the disk details page, click Edit.
In the Size field, enter the new size for your disk.
Click Save to apply your changes to the disk.
After you resize the disk, you must resize the file system so that the operating system can access the additional space.
Note: Do not resize boot disks beyond 2 TB because this is the limit.
As per the installation guide you need a server with at least 1GB of memory and your selected VM instance has 614MB of memory. If I understand correctly, when Mysql service is installed it has been occupied total memory and that might be the reason you got stuck on that point also not able to SSH the instance.

google compute engine how to recovery to 2 hours ago?

System is CentOS 7 i dont know why the /bin file missing, i cant login with ssh now.
The programs I spent a week making were all inside, no backups.
So this matter is very important to me.
Does anyone know how to restore data from a hard drive to a specific point in time?
Taking snapshots will allow you to backup your data. Now, for the process of recovery you may have a look at this documentation which will guide you in creating an instance with a snapshot taken previously.
If you cannot login via SSH, you may also try to gain access by interacting with serial console. Here are the steps:
1). Activate the “Connect to serial console” button.
Go to VM instances, click on your VM, Edit, and active “enable connecting to serial ports” in the Remote access area and click on save.
2). Create a username and password.
Go to Vm instance, click on your Vm again, Edit, and fill up the custom metadata section with:
In key: startup-script
In value:
#!/bin/bash
sudo useradd -G sudo pamela
sudo echo 'pamela:pamela5' | chpasswd
(This is a script that creates a username : pamela and password: pamela5, which you are going to use later. Please use something else for security purposes)
3). Reboot for changes to take effect.

Mysql unauthenticated users from specific machine

So one of our developers VMs is desperately trying to connect to our dev mysql server.
Looking at show full processlist shows a number of 'unauthenticated user` lines trying to connect from his specific IP.
Using ps aux | grep httpd I can see where a number of threads from httpd are running but I don't know enough to correlate what I'm seeing in the terminal with a reason his machine (not being touched) continually tries to connect.
I've looked in all crontabs and there's nothing that I can see that would do that.
Is there a way to see all processes trying to connect to a specific IP?
You can use the following to get the processes connecting to a specific ip
#netstat -ant -p | grep "ip:port"
This should give you the list, try cleaning up the processes , then do a differential analysis by disabling the crontab once and enabling them but disabling the httpd processes the next time, maybe this will help.

Uwsgi, MySQL restart on reboot in a wrong order

I am trying to setup a django website on EC2, basically I want to start MySQL server, and Uwsgi after reboot.
In order to make MySQL start on reboot, I did:
sudo cp /opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/
sudo update-rc.d mysql.server defaults
In order to make Uwsgi start on reboot, I created a file /etc/init/uwsgi.conf:
description "ubuntu uwsgi instance"
start on runlevel [2345]
stop on runlevel [06]
exec uwsgi --ini /home/ubuntu/uwsgi.ini
However the problem is that I will need mysql to start first, right now it looks like Uwsgi starts first, and tried to connect to mysql, which fails, and mysql never gets started.
Could anyone help me on how to solve this issue?
Thanks in advance
When your computer starts up, it doesn't run the init.d scripts directly. Instead, depending on what's called the "runlevel", it runs the scripts in /etc/rcN.d (where N is the runlevel). You can determine the current runlevel with the runlevel command; mine returns 2 in normal operation. That means that when the computer started up, it ran the scripts in /etc/rc2.d. The contents of rc2.d are just symlinks to scripts in /etc/init.d, named according to whether they should be started or stopped, and the order they should be run.
Use the runlevel command to find out what runlevel your computer is at (probably 2), then look in /etc/rc2.d for a link named smthing like uwsgi, which will be a symlink to /etc/init.d/uwsgi, and rename it to zzz999 - or whatever it takes to get it to sort after the other entries - that will cause it to run last.
There's more information about init.d scripts and runlevels at https://www.linux.com/news/enterprise/systems-management/8116-an-introduction-to-services-runlevels-and-rcd-scripts
Even if you start MySQL before uWSGI you're not assured it will be available when uWSGI is managing requests.
At start MySQL does some checks on database, loads InnoDB indexes, recover from transaction log or it may even hang.
You shouldn't rely on that approach.
Instead add application logic that ensures you correctly handle unavailability of database, i.e. retrying or showing an error page to the user asking to retry.

Are there any services which can monitor my website, if site is down, reboot my ec2 instance?

I have a micro instance on EC2, and I deployed a wordpress website on it. But the site will be down about every two days because mysql is killed, so visitors get "500 Internal Server Error".
And I need log in AWS, and reboot the instance. I know I should optimize the apache configuration, but rebooting the instance will be a simple solution.
I'm using a service which can monitor my website, and when site is down, they will send me a email, but they can't reboot the EC2 instance.
I configure the apache like below, it works now:
StartServers 1
MinSpareServers 1
MaxSpareServers 5
MaxClients 10
MaxRequestsPerChild 4000
Maybe you can create a bash, and put it in /etc/cron.hourly to run it every hour.
Here is the content of bash.
#!/bin/bash
#Replace MYSQL_PORT with the real port number.
netstat -na | grep LISTEN | grep MYSQL_PORT
if [ $? != 0 ]; then
reboot
fi
Don't forget to make it executable just like the below.
chmod 0755 /etc/cron.hourly/monitor_mysql.sh
Moreover you can make it check more frequently by create a file in /etc/cron.d/ like the below to check every 5 minutes.
# vi /etc/cron.d/monitor_mysql
*/5 * * * * root /path/to/monitor_mysql.sh
If you are looking for a solution with any open source tool you can always try Nagios. Which does the monitoring as well as restarting of the failed services but with some configuration effort. You can refer Nagios Site Nagios Configuration
There is something wrong if you need to reboot every few days. I don't think it's your Apache configuration, but lots of other things can be wrong.
You can use the reboot script, but you should also monitor your uptime (with a service like www.downnotifier.com) en you might think about a reinstall if you don't reach an 99,7% uptime.