how to copy paste table in MySQL to another place(hard drive)? - innodb

I am having trouble with the issue:
Our server is down so I am dealing with a lot of data on my Local server. The thing is, I want to save the table as a file accessible by others as well online, say on google drive. In other words, I want to have the table editable on google drive and someone else could just copy and paste it into their MySQL database.
However, the database type 'InnoDB' seems not able to deal with this issue easily(copy paste is not easily applicable). So would it be possible that someone tell me any method to make the table a portable file in hard drive? That way everyone could be able to check and edit it conveniently. But please don't tell me to put them into csv...
Thanks a lot!

You would have to export the schema to a .sql file. It essentially consists of all the code to create and setup the tables for your database and it will save all the data inside its tables respectively.
Since you're using MySQL, to export, use this in your Terminal:
$ mysqldump -u [username] -p[password] db_name > /path/to/destination/backup_of_db.sql
And then to import it back into MySQL, use this in your Terminal:
$ mysql -u username -p -h localhost db_name < /path/from/destination/backup_of_db.sql
Also, I would not advise sending your .sql files over the web unless you absolute have to. This is of course depends on how sensitive the data is to your company's or clients' data that is stored in it.

Related

sqlite database location node-red

I have a Node-RED flow. It uses a sqlite node. I am using node-red-node-sqlite. My OS is Windows 10.
My sql database is configured just with name "db" :
My question is, where is located the sqlite database file?
I already search in the following places, but didn't found:
C:\Users\user\AppData\Roaming\npm\node_modules\node-red
C:\Users\user\.node-red
Thanks in advance.
Edit
I am also using pm2 with pm2-windows-service to start Node-RED.
If you don't specify a full path to the file in the Database field it will create the file in the current working directory for the process, which will be where you ran either node-red or npm start.
Use full path location with file name.
It should work i guess.
This isn't a valid answer, just a workaround for those who have the same problem.
I could't find my database file. But inside Node-RED everything worked just great. So. this is what I have done as a workaround:
In Node-RED, make some select nodes to get all data from tables
Store the tables values somewhere (in a .txt file or something like that)
Create your database outside Node-RED, somewhere like c:\sqlite\db.db. Check read/write permissions
Create the tables and insert the values stored from old database
In Node-RED, inside "Database", put the complete path of the database. For example, c:\sqlite\db.db
In my case this was easy because I only had two database with less than 10 rows.
Hope this can help others.
Anyway, still waiting for a valid answer :)

Copying a file to sharepoint through SAS unix

As a part of my work I need to create few reports in SAS and export them to sharepoint site. I am trying to automate this process as shown below.
call system ("cp -p file.xls https//sharepointsite/folder1/file.xls");
when i run this code, it is not giving any error in the code but the file not uploaded into sharepoint.
Could anyone suggest me the solution for this case.
Try the following in order to extract any errors into your log
data _null_;
infile "cp -p file.xls https//sharepointsite/folder1/file.xls" pipe;
input;
list;
run;
You can also try running the command directly from your SAS server, as a shell command. If that is successful, the above should be succesful (although I wasn't aware that uploading files to sharepoint was that straightforward).
Edit: from reading around, I think it IS possible, you just need to have your sharepoint location mapped to a local directory, and to have contributor rights on the site itself. In which case make sure you use the 'local' path for the URL..

How to recover data from a corrupt SQLite3 database?

I've recovered data from a formatted hard drive for use in a lawsuit. The data is Skype logs, which are stored in SQLite3 databases. Unfortunately, the disk was formatted and a new copy of OS X was installed on the drive. I scanned the drive and found the files I am looking for, but it seems that the database I'm after is corrupt.
I tried the following command I found by searching on SO:
$ sqlite3 mydata.db ".dump" | sqlite3 new.db
Unfortunately, dumping this way excludes the table of records I'm looking for (Messages). Since I can get the format of the DB from Skype by just logging in with another account and generating a new main.db for it, do I have any additional options for extracting the contents of the corrupt DB? Failing that, is there a way to export the raw contents of the database in a text file or something? I only care about grabbing certain messages, which I can search for.
When the database is corrupt, the ".dump" command extracts all of the usable information, but then ends with a ROLLBACK because it encountered corruption.
Instead, store the output in a file:
$ sqlite3 mydata.db ".dump" > mydata.dump
Then, you can view the data directly in that file, or you can change the last line from "ROLLBACK" to "COMMIT" using a text editor. After that, you can load the valid portion of the data into a database using:
$ sqlite3 new.db < mydata.dump
First check for the PRAGMA integrity_check in command console and click on play button, note down the errors and repair them seperately or try exporting and then importing SQL file to new database and restart the database, it generally removes the slug files stored in the cache. If the above method does not work out then you can try SQLite database recovery tool https://www.recoveryandmanagement.com/repair-sqlite-database-manually/

Copy table from remote sqlite database?

Is there any way to copy data from one remote sqlite database to another? I have file replication done across two servers; however, some changes are recorded in an sqlite database local to each server. To get my file replication to work correctly, I need to copy the contents of one table and enter them into the table on the opposite system. I understand that sqlite databases are not meant for remote access; but is there any way to do what I need? I suppose I could write the contents of the table to a file, copy that file, then add the contents to the other database. This doesn't seem like the best option though, so I'm looking for another solution.
If you have access to the other database file, you can ATTACH it:
ATTACH '/some/where/else/other.db' AS remote;
INSERT INTO MyTable SELECT * FROM remote.MyTable;

Sqlite database exception: file is encrypted or is not a database in blackberry?

I am working on a firm application in which I need to create a local database on my device.
I create my local database through create statement[ It works well]
Then I use that file and perform insert operation through fire-fox sqlite plugin, I need to insert aprox 2000 rows at a time so I can not use code. I just run insert manually through sqlite plugin in fir-fox.
After that I just use that file in my place of my local database.
When I run select query through my code, It show Exception:java.lang.Exception: Exception: In create or prepare statement in DBnet.rim.device.api.database.DatabaseException: SELECT distinct productline FROM T_Electrical ORDER BY productline: file is encrypted or is not a database
I got the solution of this problem, I was doing a silly mistake by creating a file manually by right click in my RES folder, that is not correct. We need to create the database completely from SQlite plugin, then it will work fine. "Create data base from SQLITE(FIle too) and perform insertion operation from SQLITE, then it will work fine"
This is very rare problem, but i think it might be helpful for someone like me....!:)
You should check to see if there is a version problem between the SQLite used by your Firefox installation and that on the BlackBerry. I think I had the same error when I tried to build a database file with SQLite version 2.
You also shouldn't need to create the database file on the device. To create large tables I use a Ubuntu machine and the sqlite3 command line. Create the file, create the tables, insert the data and build indexes. Then I just copy the file onto the device in the proper directory.
For me it was a simple thing. One password was set to that db. I just used it and prolem got solved.

Resources