How to change mysql database directory on Xampp? - mysql

I have my old databases in D:/data and I just did a fresh install of xampp in C:/xampp, I've changed to datadir = "D:/data" in my new my.ini file but it doesn't work properly.
PhpMyadmin shows all my old databases, but when I try to delete one it says it's corrupted, and my php files doesn't connect to my databases...
What I'm doing wrong?

same thing happend for me also
It is because of You might forgot to copy the ibdata* file. You may expect this file to be located within the respective database folders just like the other related files, but you would be wrong.
My ibdata file was located at mysql/data/ibdata1; as soon as I copied that to the new location everything was good again.
Hope it will help!! :)

Related

Restore SQL database from backup of "C:\xampp\mysql\data" folder

Recently my laptop crashed and while making a backup of the XAMPP instead of taking a backup of the entire XAMPP folder I just copied the
"C:\xampp\mysql\data"
folder.
Now I am trying to restore the old database, the issue is if I try to just paste the folder of the database (Eg database folder named 'X123' - it cotains both ibd and frm files), then X123 shows up in PHPMyadmin but doesn't work as when I click on the table it says 'table doesnt exist'. I read other answers which suggested that I also replace the following files
ibdata1, ib_logfile1, ib_logfile0
When I try to do the same, MySQL simply stops working.
I have tried fixing the errors after reading some of the related answers here by importing the create_tables.sql file from "C:\xampp\phpMyAdmin\examples" and some other stuff but nothing seems to work.
I would really appreciate if you can guide me as to what would be the best way to restore this data on Windows 10.
I was able to find the solution on another answer at stackoverflow. Apologies for double post.
https://stackoverflow.com/a/46970116/9879647
In my case I also had to edit php.ini so as to increase the max execution time as well as file size that can be imported.

How to access my MySQL files on a hard drive using Windows

I was given some research data on a hard drive. All the files are in one folder and consists of .frm files, .MYD files, .MYI files, .TRG files and .TRG files.
I downloaded and installed MAMP so that I can run an MySQL Server. I launched PHPMYAdmin in a browser and chose the import option. I then navigated to the data folder and realized that it was looking for a .zip file with the structure .sql.zip. I then proceeded to zip all of the content to comply and according to the WinZip dialog box, it was going to take 3 hours! This cannot be the correct action.
I found this solution from 8 years ago (derobert):
Recover Database Files From MYD MYI FRM Files
which has a linux solution (copy the files into the /var/lib/mysql/dbname directory)
There was also a solution for Windows in which a single .frm file and a ibdata1 file is copied to the data folder (alnel). Since my intention was not to copy the data to my notebook but, instead, read it directly from the drive, I tried another solution mentioned and it turned into a nightmare....
I created a symbolic link in the data folder: c:\MAMP\bin\mysql\data called mydata
c:\mklink /D mydata e:\MyResearchData
This created a link as expected. I then reloaded PHPMyAdmin expecting to see it listed. I did not. Recognizing that the /D switch is for a soft link, I tried a hard link using /H. However, that didn't over-write the previous link. I then proceeded to delete the link and it deleted all of my data! Recovery was not as simple as if I had deleted the data from the C:\ as it was not in the Recycle Bin. I was able to use file recovery software but now I am gun-shy about trying anything unproven.
I did eventually copy all the files into the MySQL data folder (suggested by Vishal)(c:\MAMP\bin\mysql\data\MyResearchData) and refreshed PHPMyAdmin ... no luck.
I'm hoping someone can lead me in the correct direction.
Thank you in advance!
You've figured out one possible way. The other way is to find My.ini (mysql config file) in which you will find datadir and basedir like
# Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files/MySQL/MySQL Server 5.7/"
# Path to the database root
datadir=C:/ProgramData/MySQL/MySQL Server 5.7/Data
change the datadir to whatever location you have your MySQL data and restart your server. Since your current data dir is "c:\mamp\db\mysql" look for that line in the config file.
if you are going to use it often, i'd suggest installing MySQL server, workbench and mysql notifier using mysql installer for windows. It's much more easier to manage. With workbench you can do many things.

XAMPP NOT WORKING! - OS X Yosemite

I was working with XAMPP 1.8.3-3 on OS X Mavericks. After upgrading to Yosemite Mysql server stopped working. And an upgrade to XAMPP 1.8.3-5 fixed the problem and mysql server starts working.
Now the entire database list is showing on phpmyadmin, but no access to the tables. Its showing “#1146 - Table ‘DB_NAME.TABLE_NAME’ doesn’t exist”.
Unfortunately I don't have any DB backup!
I have the entire XAMPP folder backup. So how I can able to retrieve the mysql tables?
just type /Applications/XAMPP/xamppfiles/bin/mysql.server start
in terminal then start xampp
you can restore if you have all the mysql folders from XAMPP folder. (check /XAMPP/xamppfiles/var/mysql in backup)
if you have var/mysql folder, open and look for database names you had earlier.
there is a separate folder for each database you had earlier. open the folder and it will contain lots of files with table names.
if your old table engine is InnoDB you will see 2 files. with .frm and .ibd extensions.
or if you had MyISM it will contain three file per table which has .frm, .MYD and .MYI extensions.
after you verify you have all the required files in backup, you can start restoring them.
stop mysql
copy required database folder completely and paste it to currently installed folder. (/Applications/XAMPP/xamppfiles/var/mysql/)
start mysql
to restore web files, open htdocs folder in backup and copy required site folder to currentely xampp installed htdocs folder.
This solution worked for me. Good Luck !
Do a clean install. See my answer for my own question. xampp mysql server not starting. The bad part is that I'm not sure if it will save your database the way I explained. What you might try is going to xampp > xamppfiles > var > mysql > 'your database name' and making a copy of the database folder on your desktop and moving it back once you reinstall it. I tried and I think it might have worked had I changed the file permissions. You can also try experimenting to see if it preserves the database if you do this. I would do some serious testing if you really want to save your database before doing this.

MySQL db from uninstalled XAMPP?

I have done something stupid: I have started uninstalling XAMPP without exporting the DB. Realising what I had done during uninstallation, I told the installer not to delete the databases. Now I have a mysql folder with the data, but no MySQL program to handle it.
What do I do with it now? Can I simply copy it to another installation? I guess not, so what shall I do?
I tried searching the web for this, but did not find anything useful. There must be a reason for the uninstaller asking this, so how do I do it?
using xamp I once copied the all files from
mysql\mysql5.5.16\data\
to same directory my other computer. and was surprised to see it work.
but there must be some condition about same version or datadir settings.
Check your backup folder for the existence of .frm .MYI & .MYD files if the backup contains these files just install the same version of mysql and copy those files to your data folder it worked for me. May be you too.

What is the exact location of MySQL database tables in XAMPP folder?

I have a MySQL database and I want to know the exact location where this data actually stored in the XAMPP folder, I went to this file location to try to get the information:
xampp -> mysql -> data ->
Here I found a separate folder for each of my databases and within these folders I saw files stored with the .frm format (FRM FILE).
When I copied my desired database with all tables in .frm format and try to use them on another PC, I was given an empty database of the same name.
Where are the data files for the database kept on the local server?
For Mac, your database files are located at:
/Applications/XAMPP/xamppfiles/var/mysql
You might need admin permissions to access or delete your files.
Your database is in this directory:
C:\xampp\mysql\data
Rather late I know, but you can use SELECT ##datadir to get the information.
Happy file huntin' SO community :)
This is how it looks when ran in phpmyadmin:
I think the matter is your tables engine. I guess you are using InnoDB for your table. So you can not copy files easily to make a copy.
Take a look at these links:
http://dev.mysql.com/doc/refman/5.0/en/innodb-backup.html
http://dev.mysql.com/doc/refman/5.0/en/innodb-migration.html
Also I recommend you to use something like phpMyAdmin for creating your backup file and then restore the backup file on the next machine using the same IDE.
Copy and paste the entire data folder, not just the content.
I use xampp, and the path to the data is xampp/mysql/data.
The exact location is stored in "my.ini" which exists under main mysql installation directory. In my.ini file, look for 'datadir'. This parameter points the data folder.
Data are store in this path. You can search data location, just put the below address in your search location (url address):
C:\xampp\mysql\data
Just in case you forgot or avoided to copy through PHPMYADMIN export feature..
Procedure: You can manually copy: Procedure For MAC OS, for latest versions of XAMPP
Location : Find the database folders here /Users/XXXXUSER/XAMPP/xamppfiles/var/mysql..
Solution: Copy the entire folder with database names into your new xampp in similar folder.
If you are like me, and manually installed your webserver without using Xampp or some other installer,
Your data is probably stored at C:\ProgramData\MySQL\MySQL Server 5.6\data
In Ubuntu the file path is ./opt/lampp/var/mysql