Wednesday, March 28, 2007

How do I change my MySQL password?

At the "mysql>" prompt, type:
set password = password("yournewpassword");

How to install perl module

# export LANG=en_US
# perl -MCPAN -e shell
cpan> o conf prerequisites_policy ask
cpan> install Mail::SpamAssassin
cpan> q

Tuesday, March 27, 2007

MYSQL Installation & Configuration

Taken from : http://www.postfixvirtual.net/mysqlinstall.html

# cd /usr/local/src
#wget -c http://mysql.he.net/Downloads/MySQL-4.0/mysql-4.0.24.tar.gz
Create mysql user and group
#groupadd mysql
#useradd -g mysql mysql
Unpack mysql archive
# tar -zxf mysql-4.0.24.tar.gz
#cd mysql-4.0.24/
Configure mysql with /usr/local/mysql base directory
#./configure --prefix=/usr/local/mysql
Build source files
#make
Install compiled files to the directory specified in prefix
#make install
Mysql uses a configuration file to determine some parameters on startup. It must be modified depending on your machine's capacity. Copy mysql configuration file and startup script for a medium sized system to /etc/my.cnf . Read my-*.cnf files for your own system on the untarred location of MySQL. Those files allow you to chose which file to use for your system.
#mkdir /etc/mysql/
#cp support-files/my-medium.cnf /etc/mysql/my.cnf
#cp support-files/mysql.server /etc/init.d/
#chmod 755 /etc/init.d/mysql.server
Go to base directory and create MySQL grant tables with mysql user (If this MySQL is your second
MySQL installation in your linux, defaults-file variable can be set to your new conf file)
#cd /usr/local/mysql
#bin/mysql_install_db --user=mysql
Change ownership of binaries to root and ownership of data directory to mysql user
#chown -R root .
#chown -R mysql var
#chgrp -R mysql .
Introduce new libraries to our Linux
#echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
#ldconfig Start MySQL daemon
#/etc/init.d/mysql.server start
Connect to the MySQL server and give mysql root password. Since, there is no default root password
Please pay attention to this part, I have seen many who don't give any root password to their servers.
#/usr/local/mysql/bin/mysql -u root

SET MYSQL PASSWORD

mysql> use mysql;
mysql> update user set password=Password('1234') where user='root';
mysql> flush privileges;
mysql>\q

CREATE PATH VARIABLES

#PATH=$PATH:/usr/local/mysql/bin
#export PATH
#echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
#echo " export PATH" >> /etc/profile

MySQL is ready congratulations...

Monday, March 26, 2007

create multiple directories in one step

#mkdir -p /usr/local/bind/{etc,namedb,dev,var/run}

(The above command creates all necessary directories in one step - You can use curly brackets for this purpose)

Backup and Restore Mysql Database using Mysqldump

Below are mysqldump commands for backup and restore mysql database:

UNIX / LINUX

Backup:
mysqldump --opt --user=username --password database > dumpfile.sql

Restore:
mysqldump --opt --user=username --password database < dumpfile.sql
Notes:
- dumbfile.sql contains SQL command for creating tables and data. (CREATE,INSERT,DROP etc.)

Thursday, March 22, 2007

1st Entry

I created this blog so I can keep track the things which cross over my mind and works I'm working on.