mysql

Piping A File In To MySQL

Our use case here is if you have a lot of data you want to insert in the MySQL - data that you might usually use the Drupal UI for, but there's so much of it you'd rather not if you can help it!

The example here is for a client of ours. For this particular client we have to launch a few new sites a month, each one comes with a new access list of email addresses to add to the Drupal "Access rules" page. There's no bulk upload, and doing these one by one with the UI is laborious, to say the least!

Restoring The MySQL Root User

Very quick post today. I rather foolishly didn't look at a back-up of a MySQL database someone sent to me this morning. I didn't realise it contained a copy of *their* mysql table. So when I restored it, all my user data got replaced with their user data.

Frack.

Worse. Their setup did not have a root user. I'm not sure how that works out for them, but it properly stumped me! Anyway, after a good degree of poking around on Google and trying various techniques, I finally found a restore for the MySQL root user that actually works:

Database Download Script

Just thought I'd throw this one up there. It's a Linux bash shell script I wrote this morning. You know when you want to take a copy of your production database down to localhost for testing? Not rocket science, but a bit of a pain. This dramatically speeds things up.

In the past I've copied and pasted an old shell script that's been kicking around on my hard disk for years, changed the details and run it. Well this morning I thought "Enough!" I tidied it up so it accepts arguments and even has a --help argument response. This is the code:

if [ $1 = "--help" ];

Free tagging: 

Olly Mardling, the founder of one of my clients - WhatTalent.com [new window] - sent over an interesting blog post today. He has just completed an application to Seedcamp [new window], the European angel investment guys.

One of the team there made this post showing word clouds of the answers to some of the application questions:
http://blog.seedcamp.com/2008/08/2008-application-zeitgeist.html

Multi-Site In Drupal 6.x

So, you want to have many websites with many different content sets but a shared set of users, roles and sessions? Not a problem. There are many ways to skin the Drupal multi-site cat.

Meaningless mysqli Errors

Free tagging: 

I was installing a fresh copy of Drupal on Ubuntu this morning when I hit upon a problem. Half way through the installation script, Drupal kept throwing this at me:

PHP Warning: mysqli_error() [function.mysqli-error]: invalid object or resource mysqli

Followed by the equally useless:

Unable to connect to database server. The MySQL error was: .

Well thank you very much, Drupal. The message might as well just read "Something broke!"

Subscribe to RSS - mysql
© 2010 Greg Harvey. Drupal theme by Kiwi Themes.