MySQL - Restarted laptop and all databases are gone? - mysql

I use MySQL 5.6 on a Windows 7 Laptop. I restarted my laptop, came back on and for some reason it wasn't started. So I went to command prompt and restarted it (as it's not a service) only to find out my MySQL user got deleted?
Basically it's like my old MySQL user is just gone, 1. All my databases are gone which is weeks of work (as well as my database backups) 2. My root user doesn't have a password anymore?
Anyone know what's going on? Can I get my databases back? It wasn't a version upgrade or a laptop upgrade. I simply restarted my laptop as it was lagging a bit.
Anyone any ideas? Cheers.

Referred to your comments:
Yes you have the folder but it is hidden.
Type win+R or click run from start menu. And type : c:\programdata\ type enter and open mysql\data folder.
Probably you will find your data in this path.
EDIT :
Copy the Data folder safe place first. And then remove all mysql and all related files. Perform clean install. And replace your existing data folder to new one. That's all.

Related

I Didn't Get Option To Set Root Password Of Mysql During Installation

I didn't get option to set root password of mysql during installation. Now, I am unable to form instance I am beginner in mysql I have tried reinstallating the software watching youtube still didn't got that option.
Actually I had solved this problem the day after posting this question.. My main problem was I was not getting wizard for saving information regarding root password port and etc. I figured after installing quite a few time that I have been clicking on update before the actual product installation as that was first question before installing... Not having previous verison of mysql I was unable to get root wizard i.e I was able to install product but while create database or server I was having trouble with password because it was not set while installation process... Clicking on no before installation for update solved my issue
This might be useful if you have installed mySql community server.
Download MySQL Installer from here if you haven't already, then open the installer and you might see some products listed in the section, then click on reconfigure of mySQL Server, it will take you through the instructions of setting up few things including your password(which you'll probably find after clicking "next" a few windows).

Upgrade MySQL 5.6 to 5.7

I'm quite new to MySQL and learning fast. I installed WAMP on my system and have been using it for a month or so. I'm looking to upgrade MySQL to 5.7 as I will be in need of the new gis features but I can't find a easy to follow step by step on what I need to do.
I have been reading over at MySQL on how it is done but find it either confusing or incomplete, not sure which. I have been reading for the last 6 hours and still no closer to knowing how it is done.
I have backed up my databases, which I'm really not concerned with at this point as they are still in the development and learning state and will be rebuilt anyways.
How do I upgrade 5.6 to 5.7 with full instructions?
Download the ZIP version of the mysql you want to run ( not the msi installer, only because I dont know what it may do or assume when it installs )
Suggested source [www.mysql.com]
From wamp manager, Stop all services.
Go to c:\wamp\bin\mysql\ and create a new folder named appropriately i.e mysql5.5.28
Unzip the mysql and copy the contents of the MySQL folder into your newly created folder. Make sure the directory levels are the same as your existing MySQL folder.
Copy all the contents of your previous mysql\mysql5.5.10\data folder into the new data folder under your newly created version folder.
Thats EVERYTHING not just your databases, including the ibdata1, ib_logfile0, ib_logfile1 and all the mysql-bin.0000xx files.
We are going to use the recommended mysql-upgrade tool so this is ok to do.
This will also ensure that you keep all your Users and password and granted privilages intact when the upgrade is complete.
Copy c:\wamp\bin\mysql\mysql5.5.10\wampserver.conf to c:\wamp\bin\mysql\mysql5.5.28\wampserver.conf
All the folders in here are relative to where this file lives, so normally nothing need changing in here.
RIGHT CLICK wampmanager -> refresh
This will make wamp manager find your new version.
Check this by Left click wampmanager -> MySQL -> Versions Your new version should be available in the list.
From wamp manager -> MySQL -> Version click on your new version.
Normally you would have to uninstall the old wampmysql service and re-install the new wampmysql service, but wamp takes care of all that for you by just clicking the new version number.
This should also start the new mysql service, so now the new mysql is running.
BUT DONT DO ANYTHING YET!!!
Launch a command window ( using Run As Administrator ).
CD into c:\wamp\bin\mysql\mysql5.5.28\bin folder ( the new releases bin folder ).
And run
mysql_upgrade -u[your MySQL admin userid] -p > upgrade_results.txt
It will ask you for the password for the admin user you provided on the -u parameter.
enter the password.
Wait while it runs, If you have very large databases this may take some time but normally it will take anything from a few seconds to a minute or two.
This will look at your databases and do any upgrades that are required and also any upgrades/maintenace of the mysql database that MySQL uses internally.
Thats the tables that contain your userids and password and privilages and other things.
Check for errors in the upgrade_results.txt file, fix if there are any.
You can repeat this as often as you like, just refresh the data from the old versions data folder each time.
LEFT Click wamp manager -> MySQL -> Service -> Stop Service.
Then again and Start Service. This will load the changed mysql database with any new/changed config info.
At this point assuming you are staying on the newly installed version of MySQL its a good idea to run:
wampmanager -> MySQL -> MySQL Console
and run a
reset master;
To reset the log files.
from here: http://forum.wampserver.com/read.php?2,111797,124054

How to restore mysql database on freshly installed WAMP server?

I re-installed Windows 7 64 bit on my computer.
Before, re-install I forgot to take back-up of databases but luckily I had stored 'data' folder already on another drive. This folder contains:
-ib_logfile0
-ib_logfile1
-ibdata1
and sub folders named on each database. Let's take one subfolder 'etldb' which contains:
-.frm for each table
-.ibd for each table
-db.opt
When I re-installed windows I also changed the machine name suppose it is 'xyz-pc' now.
I installed the same version of wampserver 2.5 at the same location and replaced the data folder with the older one mentioned above.
The username and password for mysql are same.
I can see databases in mysql prompt as well as in phpmyadmin.
Whenever I query a table: For example, select * from tblcustomers; I get error saying that etldb.tblcustomers does not exist.
I tried different methods after reading at Google and no one works to restore my database.
Your help is requested to restore my data in database. Thanks!
You can retrieve the access to the wampserver already installed without any type of reinstall.
Just find the folder where the old wampserver was installed (default: c:\wamp). There click in the wampserver.exe to start the wampserver tray icon. You will see that the icon doesn´t turn out to green. It remains red warning you that something is wrong.
What you need to do next is click on the icon and in the menu go to the option: Apache > Service > Install Service. A DOS prompt will popup asking for a ENTER. Press ENTER and it will install Apache service again.
Next step is similar: go to the menu, then: MySQL > Service > Install Service. This time no DOS prompt for you.
The icon will turn to orange.
Finally, just click on the Restart All Services option and voilá! You will bring your old wampserver to life without have to reinstall anything.
Simple like that. Hope it helps.

Some database content disappeared after WAMP reinstallation

I screwed up the config files for Apache
I reinstalled(without any uninstall) the WAMP in same folder but instead of 2.4 I did 2.5, so WAMP failed gloriously afterward.
I can not access WAMP anymore, so I can not backup my DBs from PHPMyAdmin (any hint about how to do backup in this senario will be helpful)
I copy the whole /wamp folder content (after screwed up the install).
I installed the 2.4 version Now WAMP running All DBs are still listed there But when I accesss two of the WP sites, they ask me to create a new site title, but not allow me to set username (says"User(s) already exists.").
Now I went back PHPmyAdmin and found the db for that WP site is EMPTY
I wonder how can I retrieve the good database information stored in that original /wamp folder backup, somehow, transfer into the new one, so that the db table that is EMPTY will populate with the original data again?
Thank You
Probably the safest way to recover is to:
Stop WAMPServer.
Copy the old MySQL folders to the new install of WAMPServer
So thats
copy \wamp_backup\bin\mysql\mysql(old version) to \wamp\bin\mysql\
Start WAMPServer again.
Now in the menu
Wampserver -> MySQL -> Version
you should see you old mysql version and the new one that came with the new install as well.
Switch to the old version by clicking on the old version number on that menu.
Wamp shoud now switch from the new MySQL to the old. Wait for WAMPServer to go green again.
Check the Mysql error log, to see if anything unpleasant has happened, if not,
You can then use phpmyadmin, or whatever tool you are used to to backup your missing databases.
Then switch back to the new version of MySQL and restore the databases to this version of mysql.
I hope this goes smoothly, it should.

Manually placing MySQL database files in the data folder - WAMP - XAMPP

I recently switched from using XAMPP to WAMP on my Windows 7 machine so I can do fast switching of PHP versions.
I completely uninstalled XAMPP, but first I backed up my htdocs, apache and mysql directories just in case.
After I installed WAMP and had everything up and running, I figured I could just drop some of my databases from my old XAMPP install into the "data" directory of the mysql directory in WAMP.
So that worked and the database shows up in phpMyadmin, but there are no tables. Is this a permissions thing? Like maybe I don't have the same user in the new install of mysql? Or am I missing something?
Am I allowed to just copy MySQL databases from one data folder to another or does it not work that way?
Both instances are using MySQL 5.5 (at least that's what both README files say in both MySQL directories).
THANKS
When using phpMyAdmin out of the box so to speak in WAMP, MYSQL is installed as per its default installation with the root userid setup to have NO PASSWORD.
Some people seem to think they should make one up when they see the login screen, is that what you are doing?
When you do this phpmyadmin allows you to APPEAR to login but then as you do not have root's privilages you see almost nothing on its other screens and are allowed to do nothing.
Use
username = root
password = (leave this blank)
Then set a password, there is a link on the next page it presents. AND DONT FORGET IT!!!!
This generally isn't a good idea. RiggsFolly was asking about your table type because some table types are more forgiving than others. Other possible trouble spots include file system permission problems or MySQL permission problems (as RiggsFolly asked).
I'd suggest to do an export (as an SQL file) and import that for a complete solution.