Saturday, 29 March 2014

How to Install and configure mysql multi instance in ubuntu 12.04/13.04 server

Create multi MySQL slave on single Ubuntu server

Step-1:Login to your server as root user

Step-2:Login to your mysql server as root and execute the following command

mysql>GRANT SHUTDOWN ON *.* TO 'multi_admin'@'localhost' IDENTIFIED BY 'password';


Step-3:come out of mysql prompt and stop mysql server.To stop you can execute
[root@localhost ~]# service mysql stop

#cd /etc/mysql
#vi my.cnf    
mysqld     = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
log        = /var/log/mysqld_multi.log
user       = multi_admin
password   = password

port       = 3306
datadir    = /var/lib/mysql
pid-file   = /var/lib/mysql/
socket     = /var/lib/mysql/mysql.sock
user       = mysql
log-error  = /var/log/mysqlerp.err
server-id = 4
relay-log= /var/lib/mysql/relay-bin.log
log-bin = /var/lib/mysql/mysql-bin.log
binlog_do_db = dbname

port       = 3307
datadir    = /var/lib/mysql2
pid-file   = /var/lib/mysql2/
socket     = /var/lib/mysql2/mysql.sock
user       = mysql
server-id = 3
relay-log= /var/lib/mysql2/relay-bin.log
log-bin = /var/lib/mysql2/mysql-bin.log
binlog_do_db = dbname
log-error  = /var/log/mysqlcrm.err

vi /etc/apparmor.d/usr.sbin.mysqld
# vim:syntax=apparmor
# Last Modified: Tue Jun 19 17:37:30 2007
#include <tunables/global>
/usr/sbin/mysqld {
  #include <abstractions/base>
  #include <abstractions/nameservice>
  #include <abstractions/user-tmp>
  #include <abstractions/mysql>
  #include <abstractions/winbind>
  capability dac_override,
  capability sys_resource,
  capability setgid,
  capability setuid,
  network tcp,
  /etc/hosts.allow r,
  /etc/hosts.deny r,
  /etc/mysql/*.pem r,
  /etc/mysql/conf.d/ r,
  /etc/mysql/conf.d/* r,
  /etc/mysql/*.cnf r,
  /usr/lib/mysql/plugin/ r,
  /usr/lib/mysql/plugin/*.so* mr,
  /usr/sbin/mysqld mr,
  /usr/share/mysql/** r,
  /var/log/mysql.log rw,
  /var/log/mysql.err rw,
+ /var/log/mysql[1-9].log rw,
+ /var/log/mysql[1-9].err rw,
  /var/lib/mysql/ r,
  /var/lib/mysql/** rwk,
+ /var/lib/mysql[1-9]/ r,
+ /var/lib/mysql[1-9]/** rwk,
  /var/log/mysql/ r,
  /var/log/mysql/* rw,
+ /var/log/mysql[1-9]/ r,
+ /var/log/mysql[1-9]/* rw,
+ /var/run/mysqld/ rw,
+ /var/run/mysqld/mysqld.sock w,
  /run/mysqld/ rw,
  /run/mysqld/mysqld.sock w,
  /sys/devices/system/cpu/ r,
  # Site-specific additions and overrides. See local/README for details.
  #include <local/usr.sbin.mysqld>

#/etc/init.d/apparmor restart

#mkdir -p /var/lib/mysql2
cp -r /var/lib/mysql/ /var/lib/mysql2/
chown -R mysql:mysql /var/lib/mysql2

mysqld_multi command
check status :
mysqld_multi report
Start All Mysql Instance
mysqld_multi start
Stop All Mysql Instance
mysqld_multi stop
Start specific Mysql Instance
mysqld_multi start 1 , 2 , 3.... and so on
Stop specific Mysql Instance
mysqld_multi stop 1 , 2 ,3.... and so on

Check MySQL service :
ps -aux | grep mysql | grep -v grep

Access mysql instance :
mysql -uroot -h127.0.0.1 -P3306 -p
mysql -uroot -h127.0.0.1 -P3307 -p


Friday, 28 March 2014

MySQL server is not starting

Error massage :
[ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
140329  5:47:35
[ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)

Solution:  Please change ownership of MySQL root folder

chown -R mysql:mysql /var/lib/MySQL

and restart MySQL service

Thursday, 27 March 2014

How to Install and configure sendmail for Windows Task Scheduler

Easy way to install and configure sendmail on windows machine.

If you want using send mail on windows without installing  smtp server
you can done it, fallow below step and done process.

Requirement :

1. Windows 7/vista , 2003/2008 server
2. or above ( download to this link )

Put the zip file where you want like C:\
extract this  and rename folder name : sendEmail-v156-notls to sendmail


Add event :
Got o Event Viewer > Task Scheduler > Operational > right click on alert massage and attached task to this event

Program/script: click on browse and select sendEmail.exe
Add arguments(optional) :
-f -t -u Subject -m Task start Failed! -s -xu -xp password
Send multiple mail :
-f -t  -t -u Subject -m Task start Failed! -s -xu -xp password

click next and finish configuration!


Monday, 24 March 2014

How to fix : The Recycle Bin C:\ is corrupted. Do you want to empty the Recycle Bin for this drive.

Error massage :

Solution :

1.   Login with Administrator > Click Start button and type cmd
2.    At the command prompt enter the following line and press Enter:
 rd /s c:\$recycle.bin

3.    When prompted to confirm the deletion type Y and press Enter to confirm.
4.    Close the command prompt window and restart the PC.
A new recycle directory will have been created.

Reset Grace Period of Windows Server 2012 RDS

Error: the remote session was disconnected because there are no remote desktop license servers available to provide license in aws Solu...