I have just posted a handy dandy data type reference for MySQL in the Library. Actually it should work for any database I would think. It should be handy for all you PHP gurus out there, I find it useful when I am setting up my database tables. Take a look … I hope you find it useful!
Archive for the ‘MySQL’ Category
12
MySQL Data Types Reference
21
Simple Machines Forums (SMF) and Deleting Multiple Posts by One User
OK folks, I came up with something helpful and I thought I would pass it on. Recently I had a spam bot (or maybe a real person, who knows) join the forums. Went right through all of the security controls and verifications. Then, said user went about posting almost 500 porn posts all over my site’s forums. Posting topics, posts, pics and embedded videos, it was really bad and I was really mad. First off I banned the user, no problem. I figured I would do that so I could keep relevant info like IP and email addresses rather than just deleting him. Now I had the arduous task of removing all those damn posts and topics.
I do know that you can delete a user and tell SMF to also delete all of those users topics posts as well, but that hasn’t worked in the past so I did it on my own. Here is what I did.
20
Oracle Buys Sun Microsystems
Or, the end of the tech world as we know it. Maybe that’s too harsh, time will tell. I know one thing for sure, Oracle stepped up with an offer that was only $400 million more than IBM was tossing around (I know, “only”, but when you are talking $7+ billion it’s not so much), and I bet IBM is now pretty mad at themselves. Not just because they let Sun get away, but more importantly because Oracle with all of Sun’s technology under their belt, just became a veritable behemoth competitor.
I can’t say that Oracle buying Sun is worse than IBM buying Sun, I think either would have been bad, but I do think that IBM would have made more of the technology that Sun has, especially in the hardware arena. Most people already run Oracle on Sun, but I think Oracle was angling the software more than the hardware. Now they have the whole “stack” sewn up. They have been re-branding Red Hat Linux to provide “their own” operating system, but now they don’t have to because they really do have their own operating system with Solaris. One that lots of people prefer for running Oracle versus Linux and especially Windows. Now Oracle can provide the application, the database, the operating system and the hardware platform to run it all on, all in one nice bundle. I have come to think of it as the “O-Stack”. Now, instead of a LAMP stack, Oracle will be pushing their O-Stack.
I just hope that the folk out there that have a considerable investment in Sun (me included), not only in SPARC, but also their X86 line, didn’t just get screwed. Can Oracle keep the support going? Will they keep the hardware lines going? What will happen to Solaris, MySQL and Java (to name a few)? Only time will tell, but I for one am not pleased with this announcement.
I’ll have more updates as I find information to share.
22
MySQL Database Backup Script
Here we go folks, I thought I would share a handy little script with you that I use to backup all of the databases on a particular Linux/UNIX server. I do this by getting a list of the databases, and then using mysqldump to dump them all to a text file. This seems to be the best way (short of replication) to get good clean backups of the data. Toss it into a cron job and you can have it done automagically. There isn’t anything yet to rotate files, but I might add that later. Also, I am going to try and rewrite this in PERL so our Windows (and other OS’s that don’t have a shell like Bash) brethren can run this script as well. For now though, it’s written for Bash but almost any shell would work I think.
OK, onto the script. Read the rest of this entry »
2
Solarum’s MySQL Reference
Heads up, I have added something that I think you will find useful. I have added a MySQL reference to the Library! This is more than a cheat sheet, I try to explain the things that are going on in there as we do it, so it should be a good way to not only see how to do specific things, but also understand them as well. Check it out here and see what you think, if you see anything wrong with it or you have some tip of you own you’d like me to add, drop a line and let me know. Enjoy!
19
Installing a LAMP Stack on Ubuntu
I am using Ubuntu (Hardy Heron) as my primary desktop OS, and I wanted to install some tools for doing development work. At the same time, I thought I might run through the steps and post them for anyone else that might be looking to do the same thing. I’ll walk you through what I am doing, it’s your typical Linux Apache MySQL PHP (LAMP) stack.
First off, you can use sudo to run these install commands as your own local user, by putting sudo before each command, but I find it easier and more concise to simply use sudo to become root and install that way. I will write this article from that perspective, so if you don’t want to do this as root, simply put sudo before each command here.
You can become root by using this command from a terminal session:
sudo su -
Now that we are root, let us install MySQL which will be our database server:
apt-get install mysql-server
Next, let’s install Apache for our web server:
apt-get install apache2
In my case, I am developing in PHP, so we need to install PHP for Apache:
apt-get install php5 libapache2-mod-php5
Last but not least, if you want a nice database manager, get phpMyAdmin:
apt-get install phpmyadmin
If this is not a box that you have KVM (Keyboard, Video, Mouse) access to, and you will be connecting remotely, you will need to install the OpenSSH server so you can ssh into the server. Do this like so:
apt-get install openssh-server
Once installed, you should be able to log into the server with your user account. Please note that by default, you cannot log in as root via ssh. There you have it, now start writing some cool code!







