Dropbox Syncing Databases Corruptly - mysql

I use Dropbox for syncing my databases through my Macs(iMac & MBA). And also I've MAMP setup on both of my Macs.
It all works well except that when I create a MySQL database on my MBA for a Wordpress project of mine and then try to view the site on my iMac, I get the Wordpress installation screen even though I've successfully built the Wordpress project on my MBA before switching to my iMac.
After checking the database under my iMac, I saw that it was corrupted. The database was there but non of the tables were accessible. Then I switched back to my MBA and checked the same database there as well and it wasn't corrupted at all. It was all working fine and I was able to use the Wordpress project.
Therefore I built a test Wordpress project under my MBA again to check the database syncing and the exact same problem above happened again.
But the interesting thing is that when I start building a project on my iMac and then switch to my MBA, it all works fine in both machines.
It's really weird. Any ideas?

My first thought is line endings (or something similar). Could windows by using only /n while IOS (which is *nix based) be using /r/n ?
Another issue could be file permissions... windows is much more loose in relation to this. Do an LS with the appropriate flags and check if an execute (or some other permission) is missing.
Finally, I'd suggest you do the following:
Make one setup on windows, and one setup on mac (in 2 separate folders) containing the exact same data (etc) in the databases.
Then get a diff program (diffmerge, diff, beyond compare, etc), and compare the files to see what is different.

Related

Working on same database from 2 diffent pc's

I had a Question about working on the same MySQL database. If I am in college I am always working on my laptop. But if I get home than I rather use my PC for coding.
But I don't wanna import and export my database always. I just wanna connect to a server or something so I can work from both.
Is there any way to do that with a VPS or something? I don't mind to make one with Linux or windows but what is the easiest way to work from 2 different devices and what do I need to do to make that happen.
Install MySQL on your laptop.
Copy/move the database onto it. Use the laptop as your server when you get home.
If you don't want your laptop on all the time, use a cheap web host to share it over the t'interwebs.
If you like, look at AWS free tier. Finally, Zapier do a MySQL & OneDrive collaboration that could do what you want.

Detecting unauthorized queries to a WordPress database

I suspect that an ex-employee, who had ftp and backend access to our WordPress site, created and installed an API to allow smartphone access to our database. How can I detect queries being made to the database and see what is requesting them?
Thanks
If you want to log all MySQL (just a guess) queries you can go with the solution in this post: Log all queries in mysql
But it should be mentioned that this is not wise for a production site.
Besides, if you really expect that he could have altered the installation with malicious code you should either reinstall a fresh wordpress and transfer all data or at least validate the code files against a fresh wordpress installation to check for altered code.
Basically this is the same as for a potentially penetrated system, restart at a backup point that you trust or with a fresh copy.

Duplicating existing cakephp app for development

I need to make a development version of a cakePHP app with its own db so that a developer can work on it without disturbing the current users.
I thought it would be simple, I just copied the entire director /project to /project_dev and then copied the DB "project_db" to "project_db_dev". Then I went into /project_dev/config/database.php and changed the db to "project_db_dev".
When I went to see what I had done, I saw the app was still connecting to the same db, as if I'd changed nothing. I realized that the original folder name was referenced in /app/webroot/.htaccess so do I need to find/replace all instances of that folder name?
What steps should I follow to duplicate an existing cakePHP app?
You need to setup some kind of development lifecycle.
Generally speaking the developer shouldn't be doing any development on the server. The best way to handle it is locally using a stack of some kind such as Lamp (Linux, Apache, Mysql, PHP) switch out linux with other OS's. There are multiple cloud solution to these environments to such as Koding.com
Using something like Git for version control the developer can develop locally then push the code through to the server after is being thoroughly tested locally or on a dev server or some kind.
Keeping Dev work and Live work away from each other is key.
Could do with a bit more information.
If both databases are hosted on the same server and you have permission to access them both with the same user then all you have to do is change the name of the database in your database.php
If not you will also have to update the IP and any other additional settings port etc.
If you are still having troubles email me simpsond1988#gmail.com

MAMP - suddenly getting 404s on my localhost

I have a very simple MAMP setup, with my index.php and related files in my htdocs folder. I was rolling along fine last night, being able to access the files by typing in things like localhost/index.php. Now, all of the sudden, I get 404s (file not found on this server) when I try to connect to any of the pages that are in my localhost folder or subdirectories of it.
What's more, when I just type in localhost, it shows me some of the directories but DOES NOT show any of my .php files, even though they show up when I perform a ls in the command line.
My MAMP app shows that I am connected to my Apache/MySQL servers. I can still access the localhost/MAMP homepage. But for some obscene reason, all of the sudden my php files are inaccessible. I have changed nothing inside of them! What's going on?
Edit: Turns out I needed to change the permissions of my php files -- they were set to read and write only for sudo and read only for everyone else. I ran chmod 777 on the applicable files and things were back to normal, but this begs several questions:
Why was it working earlier then changed without me ever modifying the file permissions?
Why should I have to make it writeable for other users to be able to access it on my local host as the admin user?
If I were to deploy this code in the wild (I know MAMP isn't used that often in the wild, but still), what would I do? Wouldn't creating these kinds of permissions result in serious security holes?
EDIT 2: Aaaaaand now it's not working again. Again, no changes made to file preferences, etc., just a few tweaks to the actual php files themselves. I don't have any sharing enabled under my sharing settings in System Preferences... this behavior is really starting to become frustrating.
Open Activity Monitor and make sure all instances of Apache and MySQL are closed. Sometimes MAMP has a tendency to not actually quit those processes and the next time you start it up they're still running and it generally messes with things (how's that for a technical explanation?).
Make sure there isn't any other process that's trying to use localhost for any reason. I came across this problem with POW installed. The POW process had stopped responding and it ended up interfering with MAMP's Apache.
Make sure that MAMP's settings haven't somehow been changes. I've seen MAMP revert custom document roots for seemingly no reason which can cause this.
I'd say even before any of this open your system preferences and make sure your Mac's own built-in Apache is off. You'll be able to see this in the Sharing section (it looks like its been moved in Mavericks however).
Make sure you're not routing traffic through a VPN or SSH using Sidestep. I had this problem after going back to an old project I built with MAMP while working from a coffee shop.

Can I run (XAMPP) MySQl inside my DropBox folder?

Lots of conflicting reports out there when I google; can anyone help?
Basically I want to have the same databases available at work & home PCs, for development porpoises only.
I will only ever be physically at one PC (with a 45 minute trip between) and only then will there be database access. The MySql service will be running on both, but only one will be write/reading the database. Both run Windows 7
I don't need to bother with symlinks, junctions, etc as I have enough space in my DropBox to install all of Xampp there.
Can I do that without corruption?
I use something similar as part of my remote development testing, I have never tried to run a large set of data from this or a production database. Haha, but for testing queries and setting up a couple rows, etc... I use something very similar with little to no problems.
I believe that you can run the portable xampp and mysql from your Dropbox just go to www.portableapps.com to get the xampp and also download the portable launcher from the link on the page.
Let XAMPP server run on your computers, and the data folder saved on your cloud (DropBox, SkyDrive, etc).
You should install XAMPP portable on your root folder (c:) that is the same on all computer you use, then you can move XAMPP data folder (xampp Apache htdocs) and MySQL data (xampp Mysql/data) folder to Dropbox.
Do not use XAMPP installer, but use the portable one.
Configure the folder settings on both Apache and MySQL config file:
C:\xampp\apache\conf\httpd.conf
C:\xampp\apache\conf\extra\httpd-ssl.conf
C:\xampp\apache\conf\extra\httpd-xampp.conf
C:\xampp\mysql\bin\my.ini
Do the same with other server that you use (PostgreSQL, etc).
Make sure that you:
Always turn off XAMPP server after using on each PC.
Always sync Dropbox before changing PC, that is before logging on and after logging off on different computer.
Mind host / local domain variable on each computer.
Its probably better to use same username for all computer you want to use to run the data folder.
Other method is using PortableAppas.com, that is running the apps directly from USB.