Archive for the ‘MySQL’ Category

MySQL quick backup

Sunday, January 27th, 2008

This trick will show you how to quickly perform a MySQL backup. So let’s dump all the contents of your databases and compress them to be more portable.

mysqldump -u root -p –all-databases | gzip > myDatabases.sql.gz

If you now want to dump this data to another server, simply type:

gunzip < myDatabases.sql.gz | mysql -u root -p

Reference:

Mysqldump manual

Sun Microsystems acquires MySQL AB

Wednesday, January 16th, 2008

From Sun Microsystems web site:

Sun announced an agreement to acquire MySQL AB, an open source icon and developer of one of the world’s fastest growing open source databases. This acquisition accelerates Sun’s position in enterprise IT to now include the $15 billion database market and reaffirms Sun’s position as the leading provider of platforms for the Web economy and its role as the largest commercial open source contributor.

More information from Sun Microsystems, Cnet and MySQL web site.

MySQL: quick replacement

Thursday, December 6th, 2007

Say that you have a table called myTable with several rows and a column called URL that contains the IP address of a log server. Now imagine that you want to change the value of URL so IP address is substituted by the server name. One way to do that is as follows:

use dbname

update myTbl set URL=replace(URL,’172.16.1.10′,’logserver’);

Installing MySQL, Apache and PHP in Solaris 10

Monday, December 11th, 2006

This is a quick guide to install PHP4, MySQL4 and Apache2 in Solaris 10. In order to facilitate the management and installation of packages we will use the pkg-get tool. pkg-get is a tool to automate download and installation of binary packages, for example from Blastwave an Open Source software repository for Solaris.

Our first task will be the installation of pkg-get. At Blastwave you’ll find a complete guide on how to undertake this task. Briefly:

cd /tmp
/usr/sfw/bin/wget http://www.blastwave.org/pkg_get.pkg
pkgadd -d pkg_get.pkg all
/usr/sfw/bin/wget http://www.blastwave.org/wget-i386.bin
chmod 755 wget-i386.bin

PATH=/tmp:/opt/csw/bin:/usr/sbin:/usr/bin:

/usr/dt/bin:/usr/openwin/bin:/usr/ccs/bin
export PATH

vi /opt/csw/etc/pkg-get.conf

Pick a mirror next to you. Then:

pkg-get -i wget

PATH=/opt/csw/bin:/usr/sbin:/usr/bin:/usr/dt/bin:

/usr/openwin/bin:/usr/ccs/bin
export PATH

And now you may install other packages. But let’s focus in our target.

As Solaris 10 comes with MySQL and Apache installed by default, first we are going to uninstall them. Take a look at your system:

pkginfo | grep -i apache

system SUNWaclg Apache Common Logging
system SUNWapch2d Apache Web Server V2 Documentation
system SUNWapch2r Apache Web Server V2 (root)
system SUNWapch2u Apache Web Server V2 (usr)
system SUNWapchd Apache Web Server Documentation
system SUNWapchr Apache Web Server (root)
system SUNWapchu Apache Web Server (usr)

pkginfo | grep -i mysql

system SUNWmysqlr mysql – MySQL Database Management System (root component)
system SUNWmysqlt mysql – MySQL Database Management System (test component)
system SUNWmysqlu mysql – MySQL Database Management System (usr component)

Next task would be to uninstall these packages. Proceed as follows:

pkgrm SUNWaclg SUNWapch2d SUNWapch2r SUNWapch2u SUNWapchd SUNWapchr SUNWapchu
pkgrm SUNWmysqlr SUNWmysqlt SUNWmysqlu

Finally, install Apache, MySQL and PHP from pkg-get:

pkg-get -i apache2 mysql4 php4 mod_php

That’s all. Now configure the software as usual. Note that packages installed with pkg-get reside in /opt/csw, so I recommed adding something like this to your /etc/profile:

PATH=/opt/csw/bin:/opt/csw/mysql4/bin:$PATH
export PATH

More info:

pkg-get installation howto
pkg-get users guide
Customizing Your Working Environment

Implementing High Availability in MySQL

Saturday, January 24th, 2004

MySQL provides a built-in data replication functionality for maintaining identical copies of its data to one or more backend servers, thus providing a simple High Availability mechanism. On the other hand, the Open Source community has several projects to implement failover techniques, being one of them Heartbeat.

This article will show you how to implement a clustered, highly available and inexpensive solution based on GNU/Linux and combining MySQL as the database engine and Heartbeat as the failover mechanism. The configuration will consist of a 2-node active/passive cluster.

(more…)

Lost MySQL root password?

Sunday, August 10th, 2003

Ok, if this is your only problem this little trick will show how to recover your root password.

(more…)