Delphi XE7 embedded MySQL database - mysql

I used BDE before and deployed it with my apps and databases, and everything was very easy to setup. Now, I have Delphi XE7, FireDAC components and a MySQL database. Since I have WAMP, MySQL works for me and my database is located withing my local server. I would like to use my app on another computer, which has no servers running. Is it possible to do? I tried it today and all got is a few more gray hairs. I tried to do things listed here: http://docwiki.embarcadero.com/RADStudio/XE8/en/Connect_to_MySQL_Server_(FireDAC)
I have my .exe file. I have 'libmysqld.dll' in the same folder. I have 'data' folder which has another folder ('ccvs'), and in it I have .frm and .idb files (MySQL database with InnoDB storage engine).
I even tried with a 'my.ini' file. In the end, I installed MySQL server and administrator (I think it was the name of the application). I copied my database to 'c:\programdata\mysql...\data' and I could finally browse it, but I could not access the database. Even though I could visually see it, program told me it does not exist.
I tried this as well: www.da-soft.com/forums/anydac-general-english/howto-configure-and-setup-a-mysql-embedded-server.html
Downloaded the sample app, but those components do not exist anymore and I cannot load the project successfully.
Also this looked great, but my components don't have those options... https://www.devart.com/mydac/docs/loggingembeddedserver.htm
I would like to avoid installing MySQL and embed the database if possible.

Related

Where can I find my mySQL database (using locate doesn't help)?

First ever Stack Overflow post, thanks for your time. Any constructive criticism on how to post better, please just let me know. I have done a search on my query and have found similar posts, but I was unable to use the information within them to resolve my problem.
I have created a mysql database using the terminal window in my Ubuntu system (which I am also new to, having been a lifelong windows user). I used the following code in the terminal window:
$ mysql -u root -p
Then once in mysql, I did the following
CREATE DATABASE securities_master;
USE securities_master;
I created a user and tables in the database using some other code, that doesn't seem relevant here, so I won't bother posting. However, I then decided I would like to take a look at the tables in the database, so I downloaded an SQLite browser. It was at this point that I realized I could not find my database file.
I tried to find the answer on previous stack overflow posts, and tried the suggestions of:
locate sqlite
locate .db
locate .sqlite
locate securities_master
But unfortunately, none of these showed the file I was looking for. The only place I can think of would be what is called the 'root' directory in my computer, but the Ubuntu file manager system won't let me view it because it says I don't have permissions. Is this where it might be?
Could someone shed some light on where I might be able to find this file/database? I know it is definitely there because if I try to CREATE it again, I get the message that it can't because it already exists.
Thanks again.
sqlite and mysql are two different databases. You can't use sqlite on a mysql database. sqlite is a single-file database, in which users just open the file and read and write to it, while mysql is a more traditional relational database system with a server and a client, where the server manages the database (which is generally in a directory of files), while the client just connects to the server.
Where the mysql database is located my depend on your system, but it's usually in /var/lib/mysql. You can look in /etc/mysql/my.cnf for the configuration file, which should have a datadir option that refers to where the actual data for the database is stored.
You can check my.ini file to see where the data folder is located.
Usually there is a folder {mysqlDirectory}/data
MySQL data storage:
Commands.frm
Commands.myd
Commands.myi
The *.frm files contain the table definitions. Your *.myi files are MyISAM index files. Your *.myd files contain the table data.
as mentioned in the answer before mine, mysql and sqlite are two different systems.
You mention you used the cmd line mysql to create the database and then wanted to view the tables. If you're simply trying to see which table are created, in the same command line you used to Create the database you can run show tables;
If you're after a GUI for this, we'd need a bit more context. Is this ubuntu system a remote server, or are you using the desktop version?
You say you're a long time windows user, If you're using windows locally, I personally like SQLWorkbench for accessing my remote mysql servers.
EDIT: I just re-read your post and realised you're using local ubuntu desktop so me mentioning remote was silly, my bad! However, SQLWorkbench does have a ubuntu version at https://dev.mysql.com/downloads/workbench/

How to get MYSQL database from Xamp

I used xampp sometime ago to run mysql server. I forgot to save a copy of my database. Now my hard drive has crashed and I can only use it as external drive. Using it as an external hard drive I can access the xampp installation folder but I can't seem to find copies of mysql databases.
So this is what i tried:
But I found my database names in C:\xampp\mysql\data\voting
directory, where voting is a my database name. Now, in the voting
folder, I can find all my table names but they end in some wierd
extension (.frm or .ibd) that I cannot import to a new xampp that
I have installed. For instance there is a table in the voting
database called candidate .
My problems is that is there a way I can retrieve my database from the xampp installation folder?
If NOT, How can I get mysql database using xampp(Without sql,csv or json files)
NOTICE: The xampp directory is an old one and I cannot run it because it is on a hard drive that is slightly crashed and can be access externally to a computer.
After posting this for 3 days and getting no answer, i toiled and toiled until I got an answer.
What I did was I copied the data folder in C:\xampp\mysql directory where I installed xampp from my old xampp installation folder on my old hard drive.
I pasted the old data folder I copied into C:\xampp\mysql directory of my new hard drive.
NOTICE: there is an already existing data folder there, so I backed up before doing any changes.
Finally, I opened http://localhost/phpmyadmin/ in my browser and I can now see all my old MYSQL databases.

Exporting a table without using phpMyAdmin in MAMP

I have been working on a web application using ExtJS with a SQL Database hosted on phpMyAdmin using MAMP. About 2 weeks ago, I had to dump my old HD because of bad sectors and I got an SSD as a replacement. After installing my applications again (IDE's, Document Editing Softwares, MAMP, etc), I had to reinitialize my databases in phpMyAdmin.
Luckily, I had one of them online in production so I just exported the SQL from the server and I had a local copy again. However, there's this one other website that I do not have a backup to the SQL file of -- and I need to get that SQL file because I can't create it from memory (I think it had 30+ tables already).
I know I can plug in my old hard drive, boot from there, open MAMP, open phpMyAdmin, then export my database. However, that's too much work and I am not sure if that's a good idea.
Is there a way to extract the SQL file of a phpMyAdmin table by using the file directory/structure alone? I think MAMP is supposed to store the data somewhere so that phpMyAdmin knows where to get its SQL tables.
Update
I found my "database" under /Applications/MAMP/db/mysql/ProjectName/ but they're .frm and I'm clueless on how to open this.
Take a look at this answer: Restore the mysql database from .frm files
You'll need a couple more files other than the .frm, but you can solve it with the files alone, no need to plug in your old drive again.

How to manually import database directly into the data folder in phpMyAdmin in XAMPP?

I recently installed a new version of XAMPP. I copied and pasted database folders from the old xampp's mysql/data to the same folder in the newer version. The database names are displayed in phpMyAdmin but it does not show any data.
I know I can do a simple import/export sql to resolve this but I'd like to know why copying and pasting the database folders not working? Do I have to do something else in order to make this work?
I'm going to backup my database regularly using an auto backup tool. Apart from backing up mysql/data folder, do I also need to backup some other folders or files to have a proper database backup?
why copying and pasting the database folders not working? >> as far as I know we need to use import feature, because it will register the database to mysql's infomation_schema.
So even if the database file is stored in the correct folder, it won't show up on the phpmyadmin because it's not registered. And I think mysql didn't do any directory scanning to determine it's database line up.
To back up automatically, there are several ways you can do. Moreover if you use linux OS, you have more freedom to do that, for example create a php script to backup your db and then execute it regulary by using cron job.
hope this can help you.

Attaching an existing database with MySQL

Disclaimer: I have never used MySQL before!
I have a folder containing a number of .frm, .myd and .myi files that I believe are a MySQL database. I have pulled these files from a defunct server for a client who has not used the server or database for some years but is now looking to resurect some of the data for a new venture.
I have downloaded the latest free edition of MySQL, along with MySQL Workbench and am looking to connecct the existing database to the new installation; the equivalent to an "Attach" if I were using MS SQL Server.
I have found a few articles that say if I simply copy the folder into the data folder for MySQL and restart the service the database will show up. I have tried this (using both the data folder within the installation folder and also the "MySQL Datafiles" folder created during the intial configuration but when I restart the service nothing shows up.
How should I go about attaching this database?
Ok. I found the answer, the folder I was adding the database to was the wrong one.
Though I had found 2 "data" folders, there was a 3rd hiding in C:\ApplicationData; once I added my data files in here and restarted the MySQL service I could see the data.
On Windows 8 the default folder where MySql databases are stored is:
C:\ProgramData\MySQL\MySQL Server 5.6\data
5.6 is the version.
Please note it is ProgramData not Program Files which is easy to overlook.
Copying there and restarting the service worked fine for me. I'm even copying the DBs from an earlier 5.X version.