Recently I had to work with a large amount of data that had to be imported into MySQL via a script after being modified. I’ve found that using LOAD DATA was the quickest way to do the job.
If you are using Ubuntu for your server (or you have to work with a server using Ubuntu) you will find this error when trying to use the query:
ERROR 29 (HY000): File '....' not found (Errcode: 13)
After few seconds on Google you will find many users that managed to get over the error using the keyword LOCAL, but if you keep your MySQL updated you will see that it will not work as it could generate a security issue in your server.
To overcome this issue there is a simple workaround that require you to modify the MySQL’s AppArmor file and define directory where the program can read and write.
Be aware that allowing MySQL to read and write in a directory could lead to security problems, always review this kind of changes with a System Administrator.
The workaround is really quick:
- Open the file /etc/apparmor.d/usr.sbin.mysqld as root with your favourite text editor
- You should see a list of paths where AppArmor allow MySQL to write and read, at the end of this list add the directory where you would like that MySQL will be able to read and write following the pattern used in all the previous entries. For instance:
#This will be your dir definition
Then save and close the file.
- After you have successfully modified the file it is time to tell AppArmor that it needs to reload the configurations, so as root execute the following command:
# /etc/init.d/apparmor reload
- Then restart MySQL, as root execute the following command:
# service mysql restart
At this point you have allowed MySQL to write and read contents into your defined directory, only do this if you know what you are doing! I take no responsibility for any damage or data loss caused by a server not correctly secured.
Be careful & have fun!
last day I had to update Drupal 7.10 to the most recent at the moment (7.12), I never did something like that so I was like “here we go, 1 work day that will go burned! :D”, but thanks to the Drupal community I was able to update the installation.
Since isn’t very easy at first (reading UPGRADE.txt was not helpful unfortunately), therefore here a quick list of the steps:
- Put your site into maintenance mode or close accesses from the outside.
- First of all, backup your installation folder (usually a
rsync -av startfolder destinationfolder, or a
cp -a startfolder destinationfolder will do the job just fine)
- Then you have to backup your database (you can do it all in one step using
screen, but I bet that if you are reading this and you are experienced you already know that), depending if you are running MySQL or PostgreSQLthe instructions changes, but I think could be sum up as follows:
mysqldump -uUser -pPassword -hHost dbname > dumpname.sql
pg_dump databasename > dumpname.sql
If you use PostgreSQL you need to remember that the operations have to be done with the correct user. Refer to the documentation for further details.
- After you have done the backups, reach your site root folder and create a folder to hold the new Drupal version, something like
mkdir upgrade, then enter inside it with
- Download the archive with
- Open the archive with
tar -xzvpf drupal-7.12.tar.gz.
- Then enter the newly created directory like we did before,
- At this point we have all that we need, this step is the actual upgrade, we have to move some files in the root directory, assuming you followed this steps, the command you need is the following:
rsync -av CHANGELOG.txt COPYRIGHT.txt cron.php includes index.php INSTALL.mysql.txt INSTALL.pgsql.txt install.php INSTALL.txt LICENSE.txt MAINTAINERS.txt misc modules profiles scripts themes update.php UPGRADE.txt xmlrpc.php ../../
- After you have done that, should be an instant action, open your browser and go to your website URL and add a
/update.php at the end, you should have
- Follow the instruction on-screen to complete the update process on the database, don’t change anything from the dropdowns.
- Once the update is complete you may remove the directory we created to download and extract drupal.
Is not very short but is all you need to do.