Archive for the tag 'multiple'

Running Multiple MySQL Servers on Linux

The easiest way is to run multiple MySQL servers on Linux is to compile them with different TCP/IP ports and Unix socket files so that each one is listening on different network interfaces. Compiling in different base directories for each installation also results automatically in a separate, compiled-in data directory, log file, and PID file location for each server.

Assume that an existing 5.0.19 server is configured for the default TCP/IP port number (3306) and Unix socket file (/tmp/mysql.sock). To configure a new 5.5.4 server to have different operating parameters, use a configure command something like this:

# ./configure –with-tcp-port=port_number \
–with-unix-socket-path=file_name \
–prefix=/usr/local/mysql-5.5.4

Here, port_number and file_name must be different from the default TCP/IP port number and Unix socket file path name, and the –prefix value should specify an installation directory different from the one under which the existing MySQL installation is located.

Reference: http://dev.mysql.com/

How to replace words/strings in multiple files using sed.

sed - stream editor for filtering and transforming text

The streamline editor (sed) is very useful command for searching and replacing string/texts in multiple files.

Example 1

/var/named/# sed -i ’s/127.0.0.1/192.168.0.0.1/g’ *.com.db

Example 2

s/regexp/replacement/

Attempt to match regexp against the pattern space. If successful, replace that portion matched with replacement. The replacement may contain the special char?acter & to refer to that portion of the pattern space which matched, and the special escapes \1 through \9 to refer to the corresponding matching sub-expres?sions in the regexp.

In the above command

sed -i is used to for editing.

s is used for subsituite the following text/word.

127.0.0.1 is the string to be replaced.

192.168.0.0.1 is what you would like replace with.

g is used for global search, looking for occurrence of text in all the lines in file.

To replace string 127.0.0.1 with 192.168.0.0.1 in multiple files using sed editor run sed like this :

$ sed -i ’s/127.0.0.1/92.168.0.0.1/g’ *.com.db

In Linux and UNIX sed command is available with default installation.

sed could show me only (say) lines 12-18 of a file and not show me the rest. This was very handy when I needed to review only part of a long file and I didn’t want to alter it.

# the ‘p’ stands for print
sed -n 12,18p myfile

Reference : http://sed.sourceforge.net

In Usermin’s Read Mail module, how can I set users’ From addresses when my server hosts multiple virtual domains?

By default, when a user composed email the From field contains username@systemhostname. This can be changed by following these steps :

Login to Webmin on the same server, and enter the Usermin Configuration module.

Click on Usermin Module Configuration.

Click on Read Mail.

In the Default hostname for From: addresses field, enter the domain or hostname that you want to appear after the @ in users’ From addresses.

If you want to stop users from changing their From address (to prevent mail forging), set the Allow editing of From: address option to No.

If you have multiple virtual domains and want different users to have different domains in their From addresses, you will need to set the

From: address mapping file to the name of a file that maps real email addresses to virtual domain email addresses.

This must be a text file, with each line containing :

username fromaddress

The username part of each line must be the user’s Usermin login, and the fromaddress is the new From address to assign to that user. The

username can also be the user’s full email address as it currently appears, such as joe@yourserver.com.