XAMPP MAC OSx - use external USB drive for MySQL storage - mysql

I'm using fairly large MySQL DB Tables with XAMPP, which makes it tough with my rather small internal storage of my Mac. I thought I would just keep MySQL data on an external USB3.0 SSD drive, but it looks like it's not that easy.
Here is what I've tried:
With XAMPP ( not VM ): Moved /Applications/XAMPP/xamppfiles/var/mysql to /Volumes/myexternalssd/mysql and then pointed everything in my.cnf to that dir. The permissions seem to have copied properly. But it didn't work. MySQL does not start at all if I trash the original dir, or just keeps using the original dir if I leave it in place.
With XAMPP-VM: Moving ~/.bitnami dir to the ext drive and then symlinling ( ln -s ) to the new location. The error is then:
Cannot load stack definitions.
Dtails:
1 error occurred:
* failed to create stack: cannot deserialize stack from file "/Users/arseni/.bitnami/stackman/machines/xampp/metadata.json": open /Users/arseni/.bitnami/stackman/machines/xampp/metadata.json: operation not permitted

Related

MySQL Errcode 2 - problems creating database directories

This doesn't seem far too specific, but somehow I cannot find anyone else with this problem (at least on stack and google). People have issues with errcode 2, but every thing I've seen is people having issues with mysql's tmp directory. I've tried changing that, and that's given no luck.
I've also made sure that the owner/group of the mysql "datadir" is mysql.
I'm assuming the cause of this is because I have recently moved the mysql datadir to my /ssd directory.
I have changed the datadir location after copying /var/lib/mysql to /ssd and have restarted mysql.
For /var/lib/mysql, I renamed the mysql folder to mysql-old, as that folder was no longer in use. Just in case, I created a symlink in place of it that points to the /ssd/mysql directory.
For context, I am trying to import an sql file and it seems it cannot create the data or directories themselves. Here is the full error:
ERROR 1 (HY000) at line 33: Can't create/write to file '/var/lib/mysql/changelog/changelog.MYI' (Errcode: 2)
In this instance, I'm trying to import a database named changelog
Even after changing the datadir entirely, it still seems to want to write to /var/lib/mysql - Why is that?
You may try to look into section [mysqld] in my.cnf or mysqld.cnf in /etc/mysql/
It could be either due to too many files being open or tmp directory having no permission for your user.
http://alvinalexander.com/mysql/mysql-cant-create-write-file-error-message
I ran into similar error message when trying to create a new database. The final solution is uninstall mysql and reinstall it again. Everything was fine. There are some corruption in the file which caused the errno 2.

How to sync Mamp's mysql data folder to Dropbox

I use Mamp and recently (yesterday) I lost, apart from a two weeks old backup, all of my databases due to a unwanted disk wipeout. !kcuf
Coding is more or less intact as I moved the apache code under a dropbox folder.
So my question is, just in case it happens again, how can I sync Mamp's databases to Dropbox?
Source : Syncing MAMP with Dropbox
Open terminal and type the following commands:
A: cd ~/Dropbox/localfolder (opens the directory to put the database in)
B: cp -r /Applications/MAMP/db dbfolder (copies it into a new folder within)
C: rm -rf /Applications/MAMP/db (remove the database from MAMP folder)
D: ln -s ~/Dropbox/localfolder/dbfolder /Applications/MAMP/db (creates a direct link for MAMP without getting hands deep in coding)
Start up MAMP (If already started, just restart as it will then get the new MySQL route)
Feel much more secure
If it is already synced but somehow your Mac went all Windows on you*, Reinstalling Mamp and Dropbox and doing steps C and D will do the job.
By the way, in order to make Dropbox the location of your Mamp locals, move your all of your files to the folder of your choice and, starting Mamp, go to preferences, Web server, and Document root to change it to the new one.
Saves on recoding big deal.
*Not intended seriously here

In ''mysql'' Manager of pid file quit without update file

I am in a serious problem while installing mysql on ubuntu 12.04 32 bit. when i start mysql with command ''./mysql.server start'' I got this error Manager of pid file quit without updating pid file. I installed ''mysql-5.1.39-linux-i686-glibc23''.
I thoroughly search for the solution to fix this error but cannot resolve it yet. I copied my-medium.cnf file to the /etc directory and rename it by my.cnf also edited this file in the section ''The mysql Server'' and add these lines ''datadir = /exports/disk0/data'' but could fix this problem. Can any one help on this.
The message bout the pid file is kind of a red herring. It just means that the init script /etc/init.d/mysql did not return success. The root cause could be a variety of things, for example file permissions problems in your datadir, or the config file contained an invalid line, or dozens of other possible problems.
When you get the error about the pid file, the first thing you should do is to go read the MySQL error log file. Usually this is in the data directory, and it may be called hostname.err (where "hostname" is the name of the server you installed MySQL).
Search the file for any lines reporting "ERROR" and then use Google to research the error.

Uploading small .sql file to MySQL database file returns error (XAMPP on OS X)

I am running a fresh install of XAMPP 1.8.2 for OSX and am currently trying to upload an exported database that is 171kb in size.
Getting hit with this error
Warning: File upload error - unable to create a temporary file in Unknown on line 0
From what I have discovered it may have something to do with write permissions to a /tmp file which doesn't seem to exist on my system.
Trying to set this up so I can make changes locally on a clients website without breaking the live site.
Cheers and thanks for taking a look.
Solved
within the file uploads section of your php.ini there resides this:
;upload_tmp_dir =
To allow for uploads uncomment and give the tmp dir a home:
upload_tmp_dir = "/tmp"
The the most recent default installation of XAMPP on Lion has a couple of very important lines commented out (in regards to phpmyadmin/mysql). Not sure why, but I would love to learn the reasoning behind it.

MySQL tables on external hard drive

I have a large amount of text data I need to import into MySQL. I'm doing this on a MacBook and don't have enough space for it so I want to store it in an external hard drive (I'm not really concerned about speed at this point - this is just for testing).
What's the best way to do it?
Install MySQL on the external hard drive (is this possible on a Mac?)
Install MySQL on the laptop's hard drive and have the tables on the external (how?)
One simple hack is to create an symbolic link replacing your current mysql database file location pointing to the external disk. Google symbolic link.
sample usage would be after you shutdown mysql, change the old mysql db folder name to something else, and create the symbolic link using the ln command like below
ln -s [EXTERNAL DRIVE PATH] [MYSQL DB FOLDER PATH]
Then move all the previous content of the mysql db folder to the new location.
Open /etc/mysql/my.cnf and find the value of the datadir. Alternatively, you can find this out in the mysql monitor with
mysql> select ##datadir;
Stop mysql
sudo systemctl stop mysql
Copy the data from there to your external drive
sudo rsync -av /var/lib/mysql /mnt/myHDD/somedir/mysql
Modify the location of the datadir in my.cnf.
Start mysql again
sudo systemctl start mysql
Verify that everything is still fine and remove the original data dir.
This page contains a more extensive guide but all the additional issues it warns about were not relevant for me on my raspberry PI. I.e. I skipped them and it worked.
For the second option, a tablespace might do the trick:
http://dev.mysql.com/doc/refman/5.1/en/create-tablespace.html
User user658991 answer is halfway there.
After adding the soft link, you will need to add the following line to /etc/apparmor.d/usr.sbin.mysqld beneath the 2 lines to the old mysql folder.
/path/to/mysql/folder/on/the/external/ r
/path/to/mysql/folder/on/the/external/ ** rwk
Without these 2 lines, MySQL fails to start complaining of:
Can't create test file /path/to/mysql/folder/on/the/external/hostname.lower-test
Can't create test file /path/to/mysql/folder/on/the/external/hostname.lower-test
mysqld: Can't change dir to '/path/to/mysql/folder/on/the/external/' (Errcode: 13)
Restart apparmor for the changes to take effect.
sudo invoke-rc.d apparmor restart
With this, MySQL starts normally.