Tuesday, July 24, 2018

mysql_connect(): server sent charset unknown to the client


Once after migrate to MYSQL 8.0 , When I tried to access the MYSQL server from PHP . I got the following warning message and also I didn't get any response from MYSQL.

mysql_connect(): server sent charset unknown to the client

I found the solution from this link  https://stackoverflow.com/questions/43437490/pdo-construct-server-sent-charset-255-unknown-to-the-client-please-rep


https://stackoverflow.com/questions/43437490/pdo-construct-server-sent-charset-255-unknown-to-the-client-please-rep
Following settings helped me to resolve this issue. I have add the following setting in MYSQL configuration file “my.cnf” file and restart a MYSQL .
 [client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8

Friday, June 1, 2018

Access multiple database server from phpMyAdmin


Once phpMyAdmin is installed by default it is configured to access the local database. If we want to access the remote database we have to edit the phpMyAdmin configuration.  In linux environment configuration file is mostly available in  /etc/phpMyAdmin/config.inc.php

To connect the remote database we have to change the host name in the configuration file.

$cfg['Servers'][$i]['host']          = <<Server Name>>

To configure multiple database server
Add the following entries at the end of the file.

$i++;
 $cfg['Servers'][$i]['verbose'] =  <<Name which you want appear in the drop down>>
 $cfg['Servers'][$i]['host'] = <<Database server name or Ip Address>>
 $cfg['Servers'][$i]['port'] = '';
 $cfg['Servers'][$i]['socket'] = '';
 $cfg['Servers'][$i]['connect_type'] = 'tcp';
 $cfg['Servers'][$i]['extension'] = 'mysqli';
 $cfg['Servers'][$i]['auth_type'] = 'cookie';
 $cfg['Servers'][$i]['AllowNoPassword'] = false;

Once you have added this line,  Now we can see a Server dropdown in the phpMyAdmin login page.  Select the server name and appropriate password to login.

Thursday, May 31, 2018

Bash script to run multiple AWS EC2 instance


Step 1: open vi <<filename>>.sh
Step2:  Enter the code as follows
a.  Add this code in the first line
#!/bin/bash
b.  Connect and run the comment with in the instance
ssh -i <<keyfile >> ec2-user@<<instance Ip>> << EOF
c.  Change user into root
sudo su -
d.  Write the comment you can to execute Eg
aws s3 sync <<S3 path>>  <<local path>>
e.  Exit from root
exit
f.  exit from instance
exit
EOF
Step3: Save and exit from editor
Setp4: provide a execute permission to created .sh file
      chmod +x <<filename.sh>>
Step 5: Run the file from terminal
   ./<<filename.sh>>

Installing ClamAV Antivirus in AWS EC2 instance


Following steps will help you to setup ClamAV virus scanner in AWS Ec2 instance
Step1 : Install ClamAV
Yum install clamav clamd
Step2 : Setup up log file folder
a.       Create a new folder clamd under /var/log
b.       Provide a read write access to clamscan user
chown -R clamscan:clamscan /var/log/clamd/
Step3: If you are trying to use socket.
            a.       Create a  clamd.scan folder under /var/run
            b.       Provide a read and write access to clamscan user
chown -R clamscan:clamscan /var/run/clamd.scan/
Step4: Setup Configuration
a.       Edit the configuration file available in
vi /etc/clamd.d/scan.conf
b.       To enable logging un comment LogFile and change the path
LogFile /var/log/clamd/clamd.log
c.       If you are using Socket un comment LocalSocket and change the path
                                LocalSocket /var/run/clamd.scan/clamd.sock
d.       If you are tying to TCP port uncomment TCPSocket
Step5:  run sed -i '/^Example$/d' /etc/clamd.d/scan.conf
Step 6  Start service
                service clamd.scan start

Tuesday, March 20, 2018

Changing the stored procedure name in MYSQL


We can use the following query to rename the stored procedure in MYSQL,

UPDATE `mysql`.`proc`
SET name = '',
specific_name = ''
WHERE db = '' AND
  name = '';