Switching from MySQL to MariaDB on Ubuntu 14.04

I’ve known about MariaDB for a while, but because I wanted my development machines to match my production environments, I just stayed with MySQL. Today I found out that the production environments switched to MariaDB, so I searched around the internet to find out how to do the switch on my development machines. All are running Ubuntu 14.04, so I thought that as long as I could do it on one, it would be easy to do the rest. Well, that would be the case if there were good instructions somewhere, but I had to piece together a solution that worked for me, as I was getting error messages after following the advice of others.

Continue reading

Text Editors Freezing on Search & Replace

I created a script that is run via cron that backs up the database of one of my websites, gzips it, and emails it to me. It works great, but I like to use a text editor to search and replace the domain name, so that I can use it in a development environment. As the backup file has been getting larger, I’ve reached the point where neither Sublime Text or gedit will do a “Replace All” without totally freezing. Linux makes this a non-issue:

#search for production.com and replace with dev.com
sed -i 's/production.com/dev.com/g' ./production-dump.sql

#overwrite dev database
cat ./production-dump.sql | mysql -u username -ppassword database

Easy Backup & Restore a MySQL Database

If you want to make a database backup, it’s better to not use phpMyAdmin, because larger databases will cause that method of backup to fail. Instead, just use mysqldump, which should already be installed if mysql is installed:

#backup 
mysqldump -u username -ppassword database | gzip > ./dumpfilename.sql.gz

#restore
gunzip < ./dumpfilename.sql.gz | mysql -u username -ppassword database

Continue reading

Accidently Removed Myself From Sudoers!

I’ve used Linux for years, primarily Ubuntu Desktop and Server. Recently I had been purchasing computer parts, anticipating the building of my next computer. Last Monday I put it all together, and started in on loading my operating system of choice, Ubuntu 14.04. Moving forward, I then started installing the essential programs that I use. I really didn’t run into any problems, until I made a stupid mistake while adding myself to a group.

Continue reading